2023-04-21 10:46:24 +07:00
|
|
|
import { config } from "dotenv";
|
|
|
|
|
import http from "http";
|
|
|
|
|
import listener from "./src/client.js";
|
2023-04-24 05:51:47 +07:00
|
|
|
import { isMainProcess } from "./src/util.js";
|
2022-06-16 23:11:01 +07:00
|
|
|
|
2021-08-22 09:10:25 +07:00
|
|
|
const server = http.createServer(listener);
|
2023-04-24 05:51:47 +07:00
|
|
|
if (isMainProcess(import.meta.url)) {
|
2023-04-21 10:46:24 +07:00
|
|
|
config();
|
2023-12-13 20:04:49 +01:00
|
|
|
const port = parseInt(process.env.HTTP_PORT || "80");
|
2021-08-22 07:29:09 +07:00
|
|
|
server.listen(port, function () {
|
|
|
|
|
console.log(`server start at port ${port}`);
|
|
|
|
|
});
|
2023-04-21 10:46:24 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default server;
|