Fix SNI lock, update deps, ESM refactor

This commit is contained in:
Wildan M 2023-04-21 10:46:24 +07:00
commit 447b1b735d
13 changed files with 1204 additions and 1144 deletions

View file

@ -1,17 +1,17 @@
import { config } from "dotenv";
import http from "http";
import listener from "./src/client.js";
import { fileURLToPath } from "url";
// development endpoint (use ngrok)
require('dotenv').config()
const http = require('http');
const listener = require('./src/client');
const server = http.createServer(listener);
const port = parseInt(process.env.HTTP_PORT || "3000");
if (require.main === module) {
if (process.argv[1] === fileURLToPath(import.meta.url)) {
config();
const port = parseInt(process.env.HTTP_PORT || "3000");
server.listen(port, function () {
console.log(`server start at port ${port}`);
});
} else {
module.exports = server
}
}
export default server;