-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (26 loc) · 764 Bytes
/
Copy pathindex.js
File metadata and controls
35 lines (26 loc) · 764 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
35
import cookieParser from 'cookie-parser';
import express from 'express';
import dotenv from 'dotenv';
import { router as authRouter } from './routers/authRouter.js';
import { router as adminRouter } from './routers/adminRouter.js';
dotenv.config();
const PORT = 8081;
const app = express()
const SECRET_KEY = process.env.SECRET_KEY
app.use(express.json())
app.use(cookieParser())
app.use("/auth", authRouter)
app.use("/admin", adminRouter)
app.get('/',(req,res)=>{
res.send('Hello World')
})
const start = () => {
try {
app.listen(PORT, () => {
console.log(`Сервер запущен на http://localhost:${PORT}`)
})
} catch (e) {
console.log("ошибка ,епта, -> ", e.message);
}
}
start()