-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (28 loc) · 867 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
33
34
35
36
const express = require("express");
const cors = require("cors");
const path = require("path");
const app=express();
require("dotenv").config();
const PORT =process.env.PORT||4000;
app.use(express.json());
app.use(cors())
const userRoutes=require("./routes/attendance");
app.use("/",userRoutes);
app.listen(PORT,()=>{
console.log("server started")
})
const dbConnect = require("./config/db");
app.get("/",(req,res)=>{
res.sendFile(path.join(__dirname, '/index.html'));
});
app.get("/user/register", (req, res) => {
res.sendFile(path.join(__dirname, '/register.html'));
});
app.get("/public/:file", (req, res) => {
const {file} = req.params;
res.sendFile(path.join(__dirname, `/public/${file}`));
});
app.get("/user/public/:file", (req, res) => {
const {file} = req.params;
res.sendFile(path.join(__dirname, `/public/${file}`));
});