ecliptica/server/root.js
Primakov Alexandr Alexandrovich 4b0d9b4dbc mongoose + tests
2024-10-16 11:06:23 +03:00

25 lines
642 B
JavaScript

const fs = require('fs')
const path = require('path')
const router = require('express').Router()
const mongoose = require('mongoose')
const pkg = require('../package.json')
require('./utils/mongoose')
const folderPath = path.resolve(__dirname, './routers')
const folders = fs.readdirSync(folderPath)
router.get('/', async (req, res) => {
res.send(`
<h1>multy stub is working v${pkg.version}</h1>
<ul>
${folders.map((f) => `<li>${f}</li>`).join('')}
</ul>
<h2>models</h2>
<ul>${(await mongoose.modelNames()).map((name) => `<li>${name}</li>`)}</ul>
`)
})
module.exports = router