aboutsummaryrefslogtreecommitdiff
path: root/interface/routes/index.js
blob: 057e1df7dfb6ff853fdea5bdb92b63d370a3bb7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const express = require("express");
const router = express.Router();
const citizensController = require("../controllers/citizens.controller");
const api = require('./api');

// Setup api routes
router.use('/api', api);

// Setup main route
router.get("/", (req, res) => {
    // Get the citizens from the database
    citizensController.findXCitizens().then(citizens => {
        res.render("index", {
            citizens: citizens,
            title: "Home"
        });
    });
});

// export the router
module.exports = router;