mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
[tests] Split modules
This commit is contained in:
parent
5001341ea7
commit
a1b9296776
21
test/fixtures/module/modules/basic/index.js
vendored
21
test/fixtures/module/modules/basic/index.js
vendored
@ -1,20 +1,11 @@
|
||||
const path = require('path')
|
||||
|
||||
module.exports = function basicModule (options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Add simple vendor
|
||||
this.addVendor('lodash')
|
||||
module.exports = function basicModule (options, resolve) {
|
||||
// Add vendor
|
||||
this.addVendor('lodash')
|
||||
|
||||
// Add a plugin
|
||||
this.addPlugin(path.resolve(__dirname, 'reverse.js'))
|
||||
// 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()
|
||||
})
|
||||
resolve()
|
||||
}
|
||||
|
12
test/fixtures/module/modules/middleware/index.js
vendored
Executable file
12
test/fixtures/module/modules/middleware/index.js
vendored
Executable 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!')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
3
test/fixtures/module/nuxt.config.js
vendored
3
test/fixtures/module/nuxt.config.js
vendored
@ -1,5 +1,6 @@
|
||||
module.exports = {
|
||||
modules: [
|
||||
'~modules/basic'
|
||||
'~modules/basic',
|
||||
'~modules/middleware'
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user