-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (23 loc) · 803 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
require('./config/database');
const express = require('express');
const routes = require('./routes/userRoutes');
const path = require('path')
const morgan = require('morgan')
var cookieParser = require('cookie-parser');
require('dotenv').config();
//process.enviremantalcari.Instance_name
const port = process.env.PORT || 4000;
const app = express();
app.use(morgan('tiny'))
app.use(cookieParser())
app.set('view engine','ejs')
app.set('views', path.join(__dirname,'/views/'))
const publicDirectory = path.join(__dirname,'./public/')
app.use(express.static(publicDirectory))
app.use(express.urlencoded({ extended: true }));
app.use(express.json())
//my API'S from router folder
app.use(routes);
app.listen(port,()=>{
console.log(`This server is running on port http://localhost:${port}`);
});