-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouters.js
31 lines (26 loc) · 846 Bytes
/
routers.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
30
31
/*
* router.js
* This module contains routing handlers for the entire apps
* Date Written : Mar 3, 2022
* Written By : JWong
*/
var handlers = require('./handlers/handlers');
let appRouter = function (app) {
app.get("/shorturl", function(req, res) {
res.status(200).send('OK');
});
app.use(function(req, res, next){
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "*");
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
next();
});
app.get('/ping', handlers.ping);
app.get('/test', handlers.test);
app.post('/addURL', handlers.addURL);
app.get('/delURL', handlers.delURL);
app.get('/getURL', handlers.getURL);
app.get('/listURL', handlers.listURL);
app.get('/listStats', handlers.listStats);
}
module.exports = appRouter;