blob: dfcf98d18ca2edbc409d08e02904712ce705e2a6 (
plain)
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
|
// Import Express and CORS
const express = require("express");
const cors = require("cors");
// Import the routes
const routes = require("./routes");
// Create the server
const app = express();
// Set the port
const port = process.env.PORT || 3000;
// Set the middleware
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static(__dirname + "/public"));
app.use("/static", express.static(__dirname + "/static"));
app.use(routes);
// Set public folder
// Start the server
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
|