2023-08-01 13:14:02 +03:00
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
2024-10-16 11:06:23 +03:00
|
|
|
const router = require('express').Router()
|
|
|
|
const mongoose = require('mongoose')
|
|
|
|
|
2024-05-18 11:39:16 +03:00
|
|
|
const pkg = require('../package.json')
|
2023-08-01 13:14:02 +03:00
|
|
|
|
2024-10-16 11:06:23 +03:00
|
|
|
require('./utils/mongoose')
|
2023-08-01 13:14:02 +03:00
|
|
|
const folderPath = path.resolve(__dirname, './routers')
|
|
|
|
const folders = fs.readdirSync(folderPath)
|
|
|
|
|
2024-10-16 11:06:23 +03:00
|
|
|
router.get('/', async (req, res) => {
|
2023-08-01 13:14:02 +03:00
|
|
|
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>
|
2024-10-16 11:06:23 +03:00
|
|
|
|
|
|
|
<h2>models</h2>
|
|
|
|
<ul>${(await mongoose.modelNames()).map((name) => `<li>${name}</li>`)}</ul>
|
2023-08-01 13:14:02 +03:00
|
|
|
`)
|
|
|
|
})
|
|
|
|
|
|
|
|
module.exports = router
|