-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (20 loc) · 686 Bytes
/
index.js
File metadata and controls
26 lines (20 loc) · 686 Bytes
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
require("./stuffing.js");
require("./rnd.js");
require("./partials.js");
require("./utilitary.js");
require("./stuff.js");
require("./transformations.js");
const { createServer } = require("http");
const port = process.env.PORT || 3000;
const server = createServer((req, res) => {
const { url } = req;
const [route, query] = url.split("?");
const params = Object.fromEntries(query ? query.split("&").map(p => p.split("=")) : []);
if (route === "/unstable") {
const people = JSON.stringify(persons(+params.count || 10));
res.end(people);
}
})
server.listen(port, () => {
console.log(`Server is running at http://localhost:${port}`);
})