mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 18:29:08 +00:00
v2: init -- UI is nuked from orbit, major app restructuring
This commit is contained in:
parent
c6f5b55c1c
commit
b8da886601
108 changed files with 6717 additions and 17430 deletions
22
api/index.js
Normal file
22
api/index.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const log = new (require('../logger'))('api/index')
|
||||
const glob = require('glob')
|
||||
|
||||
const PROD = process.env.NODE_ENV === 'production'
|
||||
|
||||
module.exports = async (router, ctx) => {
|
||||
const apis = glob.sync(`./api/**/!(index).js`)
|
||||
log.debug('found apis', apis)
|
||||
|
||||
for (let a of apis) {
|
||||
if (a.endsWith('_test.js') && PROD) {
|
||||
log.debug(`skipping ${a}`)
|
||||
continue
|
||||
}
|
||||
log.debug(`mounting ${a}`)
|
||||
try {
|
||||
require(a.replace('api/', ''))(router, ctx)
|
||||
} catch (e) {
|
||||
log.error(`couldn't mount ${a}`, e)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue