-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (29 loc) · 820 Bytes
/
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
var express=require('express');
var path=require('path');
var mongoose=require('mongoose');
var dbcon=require('./config/database');
var app=express();
var user=require('./routes/users_router');
var reservation=require('./routes/reservations_route');
var lab=require('./routes/labs_rout');
var admin=require('./routes/admin_rout');
var cors=require('cors');
app.use(cors());
//database connection
var connection=mongoose.connect(dbcon.database);
if(connection){
console.log('Database connected');
}
else{
console.log('db error');
}
//static files path frontend
app.use(express.static(path.join(__dirname,"public")));
//rout handling
app.use('/user',user);
app.use('/reservation',reservation);
app.use('/lab',lab);
//app.use('/admin',admin);
app.listen(3000,function(){
console.log('Node server is up');
})