1 | const fs = require("fs"); |
2 | const path = require("path"); |
3 | const express = require("express"); |
4 | const app = express(); |
5 | const port = 8080; |
6 |
|
7 | let indexHTML = fs.readFileSync(path.resolve(__dirname, "index.html"), "utf8"); |
8 | let styleCSS = fs.readFileSync(path.resolve(__dirname, "style.css"), "utf8"); |
9 | app.get("/", function (req, res) { |
10 | res.type("html"); |
11 | res.send(indexHTML); |
12 | }); |
13 | app.get("/style.css", function (req, res) { |
14 | res.type("text/css"); |
15 | res.send(styleCSS); |
16 | }); |
17 |
|
18 | app.listen(port); |
19 |
|