forked from swindonmakers/AccessibleThingController
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstub.js
More file actions
32 lines (26 loc) · 824 Bytes
/
stub.js
File metadata and controls
32 lines (26 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var http = require('http');
var url = require('url');
var log4js = require('log4js');
log4js.configure({
appenders:[
{type:'console'}
]
});
var logger = log4js.getLogger('webserver');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
logger.info(request.url);
var queryData = url.parse(request.url, true).query;
//response.setHeader('transfer-encoding', '');
response.useChunkedEncodingByDefault = false;
if (queryData.token) {
logger.info(queryData.token);
response.write('{"access":1, "error":"blah"}');
response.end();
} else {
response.write('{"access":0, "error":"missing token"}');
response.end();
}
});
server.listen(9000);
console.log('Server is running on port 9000');