express-api-base/router/apiRoute.js
2024-06-28 11:20:46 +02:00

22 lines
451 B
JavaScript

'use strict'
// Dependencies
const express = require('express')
const { logMessage } = require('../lib/logger')
// Routes
const router = express.Router()
// Base route (allow testing if API is running)
router.get('/', async (req, res, next) => {
logMessage(req.baseUrl, 'API is running')
res.status(200).json({ result: 'OK' })
})
// Example route
router.use('/example', require('./example'))
// TODO: Add routes here
module.exports = router