aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts26
1 files changed, 26 insertions, 0 deletions
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