feat: init base module
This commit is contained in:
13
src/app.ts
Normal file
13
src/app.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useConfig } from '@abearxiong/use-config';
|
||||
import { handleMessage } from './route.ts';
|
||||
import { server as routerServer } from './modules/router.ts';
|
||||
import http from 'http';
|
||||
|
||||
const config = useConfig();
|
||||
routerServer.setHandle(handleMessage);
|
||||
|
||||
const server = http.createServer(routerServer.callback());
|
||||
|
||||
server.listen(config.port, () => {
|
||||
console.log(`Server running at http://localhost:${config.port}/`);
|
||||
});
|
||||
Reference in New Issue
Block a user