19 lines
515 B
TypeScript
19 lines
515 B
TypeScript
import express, { Application } from "express";
|
|
import Server from "./src/index";
|
|
|
|
const app: Application = express();
|
|
const server: Server = new Server(app);
|
|
const PORT: number = process.env.PORT ? parseInt(process.env.PORT, 10) : 8080;
|
|
|
|
app
|
|
.listen(PORT, "localhost", function () {
|
|
console.log(`Server is running on port ${PORT}.`);
|
|
})
|
|
.on("error", (err: any) => {
|
|
if (err.code === "EADDRINUSE") {
|
|
console.log("Error: address already in use");
|
|
} else {
|
|
console.log(err);
|
|
}
|
|
});
|