-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
32 lines (26 loc) · 870 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
const express = require('express')
const connedtDB = require('./db/connection')
const routes = require('./api/routes')
const path = require('path')
const cors = require('cors')
const app = express()
const bodyParser = require('body-parser')
const { export_params } = require('./api/config/s3_cofig')
const socketIO = require('socket.io')
require("dotenv").config();
const PORT = process.env.PORT || 3000
connedtDB()
//Bucket creating. Exception handled. (Don't Remove)
export_params.createBucket()
app.use(cors())
// app.use(fileuploader({createParentPath: true}))
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.set('views',path.join(__dirname,'views'));
app.use("/",routes)
const server = app.listen(PORT,function(){
console.log('Server started on port 3000')
});
//Socket.io
const io = socketIO(server)
app.set('io',io)