-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsampleapp.js
53 lines (43 loc) · 1.13 KB
/
sampleapp.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var express = require('express');
var DBConfig = require('./sampleconfig/sampledb');
var rolesConfig = require('./sampleconfig/sampleroles');
GLOBAL.DBConfig = DBConfig;
GLOBAL.rolesConfig = rolesConfig;
var newMod = require('./lib');
/*var cookieParser = require('cookie-parser');
var session = require('express-session');
*/
var app = express();
app.use(express.cookieParser());
app.use(express.session({secret: 'xyz'}));
app.get('/login', newMod.signIn, function(req, res){
res.jsonp({
success:true,
"message" : "Login Success"
})
});
app.get('/signUp', newMod.signUp, function(req, res){
res.jsonp({
success:true,
"message" : "signUp Success"
})
});
app.get('/addUserRole', newMod.addUserRole, function(req, res){
res.jsonp({
success:true,
"message" : "addUserRole Success"
})
});
app.get('/admin', newMod.checkUserRole, newMod.checkUrlPattern, function(req, res){
res.jsonp({
success:true,
"message" : "admin role Success"
})
});
app.get('/user', newMod.checkUserRole, newMod.checkUrlPattern, function(req, res){
res.jsonp({
success:true,
"message" : "admin role Success"
})
});
app.listen(process.env.PORT || 9001);