ddstats-server/routes/routes.js
2021-11-04 22:50:57 +01:00

30 lines
647 B
JavaScript

import { Router } from 'express'
import wrapper from '../libs/database/wrapper.js'
import tx from '../libs/routex.js'
const routes = Router()
routes.get(
'/',
(req, res) => {
tx(req, res)('pages/landing.njk', null, { currentSection: null })
}
)
routes.get(
'/maps',
(req, res) => {
const maps = wrapper.allMaps()
tx(req, res)('pages/maps.njk', { maps }, { currentSection: "maps" })
}
)
routes.get(
'/maps/:map',
(req, res) => {
const map = wrapper.map(req.params.map)
tx(req, res)('pages/mapSingle.njk', { map }, { currentSection: "maps" })
}
)
export default routes