Initial commit
This commit is contained in:
commit
ce518aeeb5
16 changed files with 1755 additions and 0 deletions
13
src/app.ts
Normal file
13
src/app.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import * as config from "./config";
|
||||
import express from "express";
|
||||
import db from "./db";
|
||||
|
||||
const app = express();
|
||||
app.use(express.static('public'));
|
||||
app.use(express.json());
|
||||
|
||||
app.get("/test", (request, response) => response.send("Test"))
|
||||
|
||||
const server = app.listen(config.port, () => {
|
||||
console.log(`Listening on port ${config.port}`);
|
||||
});
|
6
src/config.ts
Normal file
6
src/config.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
if (!process.env.PORT) {
|
||||
console.log("Missing environment variable PORT");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
export const port: number = parseInt(process.env.PORT as string, 10);
|
5
src/db.ts
Normal file
5
src/db.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
const { Pool } = require('pg');
|
||||
|
||||
const db = new Pool();
|
||||
|
||||
export = db;
|
Loading…
Add table
Add a link
Reference in a new issue