-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.js
More file actions
33 lines (24 loc) · 780 Bytes
/
router.js
File metadata and controls
33 lines (24 loc) · 780 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
33
const music = require('./controller/music.js');
const test = require('./controller/user.js');
const controller = require('./controller');
let GetRoutes = controller.get;
let PostRoutes = controller.post;
let PutRoutes = controller.put;
let DelRoutes = controller.del;
let basePath = "api/"
exports.route = (route) => {
for (let path in GetRoutes) {
route.get(basePath + path, GetRoutes[path]);
}
for (let path in PostRoutes) {
route.post(basePath + path, PostRoutes[path]);
}
for (let path in PutRoutes) {
route.put(basePath + path, PutRoutes[path]);
}
for (let path in DelRoutes) {
route.del(basePath + path, DelRoutes[path]);
}
}
// GetRoutes['/api/Music'] = music.getMusicById; //scott御用接口
// GetRoutes['api/Test'] = test.test;