domain-forward/index.js

15 lines
425 B
JavaScript
Raw Normal View History

import { config } from "dotenv";
import http from "http";
import listener from "./src/client.js";
import { isMainProcess } from "./src/util.js";
2022-06-16 23:11:01 +07:00
const server = http.createServer(listener);
if (isMainProcess(import.meta.url)) {
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}`);
});
}
export default server;