MCPcopy
hub / github.com/ineo6/hosts / createServer

Function createServer

src/cli.ts:59–79  ·  view source on GitHub ↗
({port}: { port: number })

Source from the content-addressed store, hash-verified

57}
58
59async function createServer({port}: { port: number }) {
60 const foundPort = await portfinder.getPortPromise({port});
61
62 http.createServer((request, response) => {
63 response.writeHead(200, {'Content-Type': 'text-plain;charset=utf-8'});
64
65 response.end(getHosts());
66 }).listen(foundPort);
67
68 const localUrl = `http://localhost:${foundPort}`;
69
70 console.log();
71 console.log(
72 [
73 ` 当前版本:${pkg.version}`,
74 ` Github Hosts 运行在:`,
75 ` - Local: ${chalk.cyan(localUrl)}`,
76 ].join('\n'),
77 );
78 console.log();
79}

Callers 1

cli.tsFile · 0.85

Calls 1

getHostsFunction · 0.85

Tested by

no test coverage detected