-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
31 lines (26 loc) · 909 Bytes
/
server.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
import express from "express";
import path from "path";
import bodyParser from "body-parser";
import { dirname } from "path";
import { fileURLToPath } from "url";
import contactRoutes from "./routes/contactRoutes.js";
import shipperRoutes from "./routes/shipperRoutes.js";
import loginRoutes from "./routes/loginRoutes.js";
import signupRoutes from "./routes/signupRoutes.js";
// Define __filename and __dirname
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const app = express();
// Middleware to parse incoming form data
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, "public")));
// Use the routes
app.use(contactRoutes);
app.use(shipperRoutes);
app.use(loginRoutes);
app.use(signupRoutes);
// Start the server
const PORT = 3308;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});