multy-stub/server/root.js

19 lines
461 B
JavaScript
Raw Permalink Normal View History

2023-08-01 13:14:02 +03:00
const router = require('express').Router()
const fs = require('fs')
const path = require('path')
2024-05-18 11:39:16 +03:00
const pkg = require('../package.json')
2023-08-01 13:14:02 +03:00
const folderPath = path.resolve(__dirname, './routers')
const folders = fs.readdirSync(folderPath)
router.get('/', (req, res) => {
res.send(`
2024-05-18 11:39:16 +03:00
<h1>multy stub is working v${pkg.version}</h1>
2023-08-01 13:14:02 +03:00
<ul>
${folders.map((f) => `<li>${f}</li>`).join('')}
</ul>
`)
})
module.exports = router