mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-05 03:47:12 +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
|
||||||
|
|
||||||
|
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
|
// Create new connect instance
|
||||||
this.app = connect()
|
this.app = connect()
|
||||||
|
}
|
||||||
|
|
||||||
// Renderer runtime resources
|
// Renderer runtime resources
|
||||||
this.resources = {
|
this.resources = {
|
||||||
|
Loading…
Reference in New Issue
Block a user