-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
28 lines (24 loc) · 815 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
const fs = require('fs');
const path = require('path')
const express = require('express');
const session = require('express-session');
const router = express.Router();
// create resouce folder to save the m4a files in the server
const resourcepath = path.join(__dirname, 'resources');
fs.mkdirSync(resourcepath, { recursive: true });
const app = express()
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(express.urlencoded({extended: true}));
app.use(express.json());
app.use(session({
session_id: function(req) {return genuuid()},
secret:'XASDASDA',
saveUninitialized: true,
resave: false
}))
app.use('/', router);
app.listen(process.env.PORT || 5000, () => {
console.log(`Server started on ${process.env.PORT}`);
})
require('./routes/api_routes')(router);