Commit 7125a854 by zhengyoujia

Merge branch 'revert-2cc8719b' into 'master'

Revert "Merge branch 'initServer' into 'master'"

See merge request !4
parents 24327e7a 8827e87b
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
}, },
"bin": { "bin": {
"screen": "out/main.js" "screen": "out/main.js"
} },
"devDependencies": {}
}, },
"node_modules/@alicloud/dybaseapi": { "node_modules/@alicloud/dybaseapi": {
"version": "1.0.0", "version": "1.0.0",
......
...@@ -27,10 +27,7 @@ ...@@ -27,10 +27,7 @@
"xml2js": "^0.4.23" "xml2js": "^0.4.23"
}, },
"scripts": { "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", "author": "cjj",
"license": "ISC", "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 { httpServer } from "./net/http_server";
import { initConfig, systemConfig } from "./config/serverConfig"; import { initConfig, systemConfig } from "./config/serverConfig";
// import { test2 } from "./test"; import { test2 } from "./test";
let fs = require('fs'); let fs = require('fs');
async function lanuch() { 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