[tests] Split modules

This commit is contained in:
Pooya Parsa 2017-05-15 03:15:01 +04:30
parent 5001341ea7
commit a1b9296776
3 changed files with 20 additions and 16 deletions

View File

@ -1,20 +1,11 @@
const path = require('path')
module.exports = function basicModule (options) {
return new Promise((resolve, reject) => {
// Add simple vendor
module.exports = function basicModule (options, resolve) {
// Add vendor
this.addVendor('lodash')
// Add a plugin
this.addPlugin(path.resolve(__dirname, 'reverse.js'))
// Add simple api endpoint
this.addServerMiddleware({
path: '/api',
handler (req, res, next) {
res.end('It works!')
}
})
resolve()
})
}

View File

@ -0,0 +1,12 @@
module.exports = function middlewareModule (options) {
return new Promise((resolve, reject) => {
// Add /api endpoint
this.addServerMiddleware({
path: '/api',
handler (req, res, next) {
res.end('It works!')
}
})
})
}

View File

@ -1,5 +1,6 @@
module.exports = {
modules: [
'~modules/basic'
'~modules/basic',
'~modules/middleware'
]
}