-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (25 loc) · 776 Bytes
/
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
import express from 'express';
import dotenv from 'dotenv';
import cors from 'cors';
import { dbConnect } from './db.js';
import { userRouter } from './Routers/user.js';
import { forgotRouter } from './Routers/forgotPassword.js';
import { resetRouter } from './Routers/resetPassword.js';
// config dotenv
dotenv.config()
// PORT
const PORT = process.env.PORT ;
// initializing the server
const app = express();
// initializing the database
dbConnect();
// middleware
app.use(express.json());
app.use(cors());
// application routes
app.use('/signup' , userRouter);
app.use('/login', userRouter);
app.use('/forgot', forgotRouter);
app.use('/reset', resetRouter);
// listening the server
app.listen(PORT, () => console.log(`server is running at http://localhost:${PORT}`))