first sync

This commit is contained in:
41666 2017-12-04 21:25:13 -06:00
parent 5d6f382c8a
commit a4acc441ea
52 changed files with 28315 additions and 0 deletions

3
Server/api/auth.js Normal file
View file

@ -0,0 +1,3 @@
module.exports = R => {
}

20
Server/api/index.js Normal file
View file

@ -0,0 +1,20 @@
const log = new (require('../logger'))('api/index')
const glob = require('glob')
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') !== null && process.env.NODE_ENV !== 'development') {
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)
}
}
}

6
Server/api/servers.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = (R, $) => {
R.get('/api/servers', (ctx) => {
ctx.body = 'hi'
console.log($)
})
}