-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
64 lines (47 loc) · 1.92 KB
/
server.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var express = require('express'),
app = express();
bodyParser = require('body-parser'),
mongoskin = require('mongoskin'),
cardsController = require('./server/controllers/cards-controller');
var db = mongoskin.db('mongodb://@localhost:27017/trellodemo', {safe:true})
app.use(bodyParser.urlencoded({
extended:true
}));
app.use(bodyParser.json());
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
return next()
})
app.use('/js',express.static(__dirname+'/client/js'));
app.use('/css',express.static(__dirname+'/client/css'));
app.use('/bootstrap',express.static(__dirname+'/client/bootstrap'));
app.use('/templates',express.static(__dirname+'/client/templates'));
// app.use('/', express.static(__dirname + '/public'));
// app.use('/images', express.static(__dirname + '/public/images'));
// app.use('/images',express.directory(__dirname + '/public/images'));
app.get('/',function(req,res){
res.sendFile(__dirname+'/client/views/index.html');
})
app.get('/api/data/collections/:collectionName', cardsController.getCollection);
app.get('/api/data/collections/leavereport', cardsController.getLeaveReport);
app.get('/leavereport',function(req,res){
res.sendFile(__dirname+'/client/views/index.html');
})
app.get('/leavereport/listview',function(req,res){
res.sendFile(__dirname+'/client/views/index.html');
})
app.get('/leavereport/calendarview',function(req,res){
res.sendFile(__dirname+'/client/views/index.html');
})
app.get('/about',function(req,res){
res.sendFile(__dirname+'/client/views/index.html');
})
app.get('/template/tooltip/tooltip-html-unsafe-popup.html',function(req,res){
res.sendFile(__dirname+'/client/template/tooltip/tooltip-html-unsafe-popup.html');
})
//REST API
//app.get('/api/cards',cardsController.list);
//app.post('/api/cards',cardsController.create);
app.listen(3000,function(){
console.log('I\'m Listening...')
})