-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
31 lines (26 loc) · 784 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
require("dotenv").config()
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
const cors = require('cors')
const fileUpload = require('express-fileupload');
const ErrorHandlerMiddleware = require('./WeSociety.Api/Middlewares/ErrorHandlerMiddleware')
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
app.use(cors())
app.use(fileUpload({
createParentPath: true
}));
app.use(function(req, res, next) {
for (var key in req.body)
{
req.body[key.charAt(0).toUpperCase()+key.slice(1)] = req.body[key];
}
next();
});
//Require Routes
require("./WeSociety.Api/Routes/AllRoutes")(app);
app.use(ErrorHandlerMiddleware)
app.listen(4000, () => {
console.log("Server started at 4000");
})