-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 920 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
require('dotenv').config();
const port = process.env.PORT;
const express = require("express");
const db = require("./database/conn");
const bodyParser = require('body-parser');
const cors= require('cors');
const app = express();
app.use(express.json({limit: '50mb'}));
app.use(express.urlencoded({limit: '50mb'}));
app.use(cors());
// app.use((req, res, next) => {
// res.setHeader('Access-Control-Allow-Origin', 'http://127.0.0.1:8080/'); // Replace with the URL of your front-end application
// res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
// res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
// next();
// });
app.use(express.static('public'));
app.use(express.json());
app.listen(port, () => {
console.log(`connection is setup at ${port}`);
})
module.exports = app;
require('./controller/UserController');
require('./controller/ExpenseController');