boilerplate

This commit is contained in:
biglyderv 2025-02-25 13:00:10 -05:00
commit bf77320bc7
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
10 changed files with 3638 additions and 0 deletions

28
index.js Normal file
View file

@ -0,0 +1,28 @@
import express from "express";
const app = express()
const port = 3000;
app.use(express.static('public'));
app.set('view engine', 'ejs');
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
app.use((req, res, next) => {
res.ctx = {
mainPage: '404.ejs',
mainCtx: {},
headerCtx: {}
};
next();
})
app.use('/api', (req, res, next) => {
res.send(res.ctx);
})
app.use((req, res, next) => {
res.render('root.ejs', res.ctx)
})