Commit ac88b270 by Leo Zheng

初始化服务器设置

parent 4468b9ea
......@@ -33,8 +33,7 @@
},
"bin": {
"screen": "out/main.js"
},
"devDependencies": {}
}
},
"node_modules/@alicloud/dybaseapi": {
"version": "1.0.0",
......
......@@ -27,7 +27,10 @@
"xml2js": "^0.4.23"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"start": "node out/main.js",
"dev": "npx ts-node src/main.ts"
},
"author": "cjj",
"license": "ISC",
......
interface SystemConfig {
port: number;
}
const systemConfig: SystemConfig = {
port: 3000
};
async function initConfig(): Promise<void> {
return new Promise((resolve) => {
setTimeout(() => {
console.log("Configuration Initialized");
resolve();
}, 1000);
});
}
export { initConfig, systemConfig };
import { httpServer } from "./net/http_server";
import { initConfig, systemConfig } from "./config/serverConfig";
import { test2 } from "./test";
// import { test2 } from "./test";
let fs = require('fs');
async function lanuch() {
......
import * as http from 'http';
const httpServer = {
createServer(port: number): void {
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, () => {
console.log(`Server running at http://localhost:${port}/`);
});
}
};
export { httpServer };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment