-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (19 loc) · 702 Bytes
/
index.js
File metadata and controls
22 lines (19 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import dotenv from 'dotenv';
dotenv.config();
//sử dụng thư viện nodemailer để gửi email
import express from 'express';
import db from './config/db.js';
import route from './routes/clients/index.route.js';
import cors from 'cors';
import cookieParser from 'cookie-parser';
db();
const app = express();
const port = process.env.PORT ;
app.use(express.json()); // Middleware để parse JSON body
app.use(express.urlencoded({ extended: true }));//middleware để parse json body từ form
app.use(cors()); // Middleware để cho phép CORS
app.use(cookieParser()); // Middleware để parse cookies
route(app);
app.listen(port, () => {
console.log(`App listening on port ${port}`)
});