bootstrap js projects
This commit is contained in:
18
express-js/server.ts
Normal file
18
express-js/server.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user