mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 11:27:13 +00:00
Allow custom HTTP server instance from user
This commit is contained in:
parent
cafc94d9f9
commit
22d5424caf
@ -225,6 +225,7 @@ Options.defaults = {
|
||||
css: [],
|
||||
modules: [],
|
||||
layouts: {},
|
||||
serverInstance: null,
|
||||
serverMiddleware: [],
|
||||
ErrorPage: null,
|
||||
loading: {
|
||||
|
@ -39,8 +39,16 @@ export default class Renderer extends Tapable {
|
||||
this.webpackDevMiddleware = null
|
||||
this.webpackHotMiddleware = null
|
||||
|
||||
// Create new connect instance
|
||||
this.app = connect()
|
||||
if (typeof this.options.serverInstance === 'string') {
|
||||
// Resolve the module from rootDir
|
||||
this.app = require(this.nuxt.resolvePath(this.options.serverInstance))()
|
||||
} else if (this.options.serverInstance instanceof Function) {
|
||||
// Use the instance directly
|
||||
this.app = this.options.serverInstance
|
||||
} else {
|
||||
// Create new connect instance
|
||||
this.app = connect()
|
||||
}
|
||||
|
||||
// Renderer runtime resources
|
||||
this.resources = {
|
||||
|
Loading…
Reference in New Issue
Block a user