From 5c662ac5b4f6664d4d0a1d501d7d2fa2f2fc0621 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Wed, 9 Feb 2022 17:22:30 -0600 Subject: Start rewriting the entire app Signed-off-by: Matt Strapp --- src/index.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/index.ts (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..09126ca --- /dev/null +++ b/src/index.ts @@ -0,0 +1,26 @@ +import express, { Request, Response } from 'express'; +import path from 'path'; +import { env } from 'process'; + +const app = express(); + +const port = env.PORT || 2000; + +app.set('view engine', 'ejs'); +app.set('views', path.join(__dirname, 'views/pages')); +app.use('/public', express.static(path.join(__dirname, 'public'))); + + +app.get('/', (req: Request, res: Response) => { + res.render('index', { + errors: [], + }); +}); + +app.get('/about', (req: Request, res: Response) => { + res.render('about'); +}); + +app.listen(port, () => { + console.log(`Server is listening on port ${port}`); +}); \ No newline at end of file -- cgit v1.2.3