-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (21 loc) · 994 Bytes
/
index.js
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
var Server = require("./server/server").Server,
Router = require("./server/routing").Router,
Dispatcher = require("./server/routing").Dispatcher,
AuthHandler = require('./handlers/auth').AuthHandler,
IoHandler = require('./handlers/io').IoHandler,
InfoHandler = require('./handlers/info').InfoHandler,
AccountHandler = require('./handlers/account').AccountHandler;
var routingMap = {
"account/info" : { "GET" : AccountHandler.info },
"account/create" : { "POST" : AccountHandler.create },
"auth" : { "POST" : AuthHandler.login },
"io(.*)\\?{0,1}.*" : { "GET" : IoHandler.send,
"PUT" : IoHandler.receive,
"DELETE": IoHandler.remove,
"MKCOL" : IoHandler.mkdir},
"info/metadata(.*)\\?{0,1}.*": { "GET" : InfoHandler.getMetadata}
};
var router = new Router(routingMap);
var dispatcher = new Dispatcher(router);
var server = new Server(dispatcher);
server.listen(require('./config').server.port);