-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (24 loc) · 782 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 { createConnection } from "./dbconnection.js";
dotenv.config();
import cors from "cors";
import { loginRouter } from "./Routes/login.js";
import { signupRouter } from "./Routes/signup.js";
const app = express();
const PORT = process.env.PORT || 3002;
createConnection();
app.use(express.json());
app.use(cors());
app.use("/user", signupRouter);
app.use("/user", loginRouter);
app.get('/',(req,res)=>{
return res.status(200).json({message: 'server working'})
})
//================================================================
app.get("/home", (req, res) => {
return res.status(200).json({message:"server working"});
});
app.listen(PORT,'0.0.0.0', () => {
console.log(`listening on port ${PORT}`);
});