forked from parthbhatt268/api-rapidBasket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (23 loc) · 958 Bytes
/
app.js
File metadata and controls
34 lines (23 loc) · 958 Bytes
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
34
const express = require("express")
const cors = require("cors")
var bodyParser = require('body-parser')
const router = require("./src/Router/index")
const ErrorHandlerMw = require("./src/Middleware/error-handler.mw")
const jwt = require('jsonwebtoken');
const app = express()
app.use(cors())
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS');
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, authorization");
next();
});
app.use(express.json({ limit: "50mb" }))
app.use(express.urlencoded({ limit: "50mb", extended: true, parameterLimit: 50000 }))
app.use(bodyParser.json())
app.use("/api/v1/rapidBasket",router)
app.use(ErrorHandlerMw)
app.get('*', function(req, res){
res.status(404).send("Something went Wrong. Please refresh!!!");
});
module.exports = app