Compare commits
2 Commits
9d3edcf0dd
...
bbc315e270
Author | SHA1 | Date | |
---|---|---|---|
bbc315e270 | |||
|
fbb5d26c8f |
@ -10,14 +10,23 @@ const folderPath = path.resolve(__dirname, './routers')
|
|||||||
const folders = fs.readdirSync(folderPath)
|
const folders = fs.readdirSync(folderPath)
|
||||||
|
|
||||||
router.get('/', async (req, res) => {
|
router.get('/', async (req, res) => {
|
||||||
res.send(`
|
res.send(`
|
||||||
<h1>multy stub is working v${pkg.version}</h1>
|
<h1>multy stub is working v${pkg.version}</h1>
|
||||||
<ul>
|
<ul>
|
||||||
${folders.map((f) => `<li>${f}</li>`).join('')}
|
${folders.map((f) => `<li>${f}</li>`).join('')}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>models</h2>
|
<h2>models</h2>
|
||||||
<ul>${(await mongoose.modelNames()).map((name) => `<li>${name}</li>`)}</ul>
|
<ul>${
|
||||||
|
(await Promise.all(
|
||||||
|
(
|
||||||
|
await mongoose.modelNames()).map(async (name) => {
|
||||||
|
const count = await mongoose.model(name).countDocuments()
|
||||||
|
return `<li>${name} - ${count}</li>`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)).map(t => t).join(' ')
|
||||||
|
}</ul>
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user