-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
36 lines (28 loc) · 1.16 KB
/
app.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
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const path = require('path');
const passport = require('passport');
const mongoose = require('mongoose');
const expressValidator = require('express-validator');
const cors = require('cors');
const databaseController = require('./api/controllers/databaseController');
const routesLoginRegister = require('./api/routes/');
const routesCRUDevent = require('./api/routes/eventRouter');
const routesSubscribeEvent = require('./api/routes/eventSubscribeRouter');
const routesUserPanel = require('./api/routes/userPanelRouter');
const {isAuthentic} = require('./api/controllers/userController');
const async = require('async');
app.use(bodyParser.json());
//app.use(cors);
app.use(expressValidator());
app.use('/', express.static(__dirname + '/public'));
//next routes will be with '/api' part: /api/register and so on...
app.use('/api', routesLoginRegister);
app.use('/api', routesCRUDevent);
app.use('/api', routesSubscribeEvent);
app.use('/api', routesUserPanel);
databaseController.connectWithTheDatabase();
app.listen(3000,function(){
console.log("Server started on 3000");
});