feat(*): 代码仓库初始化
This commit is contained in:
23
Server/tests/test1/server.js
Normal file
23
Server/tests/test1/server.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const http = require("http");
|
||||
const fs = require("fs");
|
||||
const common = require(__dirname + "/common");
|
||||
|
||||
const server = http.createServer();
|
||||
|
||||
server.on("request", (req, res) => {
|
||||
fs.readFile("./index.html", { encoding: "utf8" }, (err, data) => {
|
||||
if (err) {
|
||||
res.writeHead(500);
|
||||
res.end("Error Loading File");
|
||||
} else {
|
||||
res.writeHead(200, {
|
||||
"content-type": "text/html",
|
||||
});
|
||||
res.end(data.replace("@@@", JSON.stringify(common.getAll())));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
server.listen(3000, () => {
|
||||
console.log("server is running at http://127.0.0.1:3000");
|
||||
});
|
||||
Reference in New Issue
Block a user