mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 19:37:18 +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: [],
|
css: [],
|
||||||
modules: [],
|
modules: [],
|
||||||
layouts: {},
|
layouts: {},
|
||||||
|
serverInstance: null,
|
||||||
serverMiddleware: [],
|
serverMiddleware: [],
|
||||||
ErrorPage: null,
|
ErrorPage: null,
|
||||||
loading: {
|
loading: {
|
||||||
|
@ -39,8 +39,16 @@ export default class Renderer extends Tapable {
|
|||||||
this.webpackDevMiddleware = null
|
this.webpackDevMiddleware = null
|
||||||
this.webpackHotMiddleware = null
|
this.webpackHotMiddleware = null
|
||||||
|
|
||||||
// Create new connect instance
|
if (typeof this.options.serverInstance === 'string') {
|
||||||
this.app = connect()
|
// 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
|
// Renderer runtime resources
|
||||||
this.resources = {
|
this.resources = {
|
||||||
|
Loading…
Reference in New Issue
Block a user