index.js 440 Bytes
Newer Older
Pithon Kabiro's avatar
Pithon Kabiro committed
1
2
3
4
5
6
7
8
9
10
11
const express = require("express");

const app = express();
const port = process.env.PORT || 3000;

app.use(express.static("public"));

app.get("/", (req, res) => {
  res.sendFile(__dirname + "/index.html");
});

Pithon Kabiro's avatar
Pithon Kabiro committed
12
13
14
15
app.get("/index.html", (req, res) => {
  res.redirect("/");
});

16
17
18
19
app.get("/test", (req, res) => {
  res.sendFile(__dirname + "/test.html");
});

Pithon Kabiro's avatar
Pithon Kabiro committed
20
21
22
app.listen(port, () => {
  console.log(`App listening at localhost:${port}`);
});