-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (29 loc) · 967 Bytes
/
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
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');
var index = require('./routes/index');
var users = require('./routes/user');
var invitations = require('./routes/invitation');
var friends = require('./routes/friend');
var tasks = require('./routes/task');
var maladies = require('./routes/maladie');
var port = 3000;
var app = express();
//View Engine
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.engine('html', require('ejs').renderFile);
// Set Static Folder
app.use(express.static(path.join(__dirname, 'client')));
// Body Parser MW
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use('/', index);
app.use('/user', users);
app.use('/invitation', invitations);
app.use('/friend', friends);
app.use('/task', tasks);
app.use('/maladie', maladies);
app.listen(port, function(){
console.log('Server started on port '+port);
});