-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (32 loc) · 1.04 KB
/
index.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
33
34
35
36
37
const express = require('express')
const helmet = require("helmet");
const fs = require('fs');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const bcrypt = require('bcrypt');
const multer = require('multer');
const path = require('path');
let CORS = require('cors');
const jwt = require('jsonwebtoken');
const uuid = require('uuid');
const crypto = require('crypto');
require('dotenv').config()
const app = express()
app.use(helmet());
const errorHandler = require('./service/error-handler');
app.use(bodyParser.urlencoded({ limit: '10mb', extended: true }))
app.use(bodyParser.json({ limit: '10mb' }));
app.use(CORS());
app.use('/users', require('./controller/users.controller'));
app.get('/', (req, res) => {
res.send('Leap forg backend');
})
app.use(errorHandler.errorHandler);
mongoose.set('strictQuery', false);
mongoose.connect(process.env.MONGOURL, (err, res) => {
console.log('err',err);
if (err) return err;
app.listen(process.env.PORT, () => {
console.log('Port 3000 running');
});
})