Skip to content
This repository

Skip calling 'listen' on server that is passed in #274

Closed
bharrisau opened this Issue July 23, 2012 · 3 comments

2 participants

Ben Harris Benjamin Arthur Lupton
Ben Harris

When I pass in a server when calling docpad.createInstance, docpad shouldn't call listen. Would be good to either default to not calling when server is provided, or have an option to skip calling listen (setting port to 'skip'?).

Benjamin Arthur Lupton
Owner

You can set the extendServer option to false, which would stop it from starting listen (but also stop it from attaching routes and whatnot).

Is it possible to provide the source of how you're using DocPad, as that way I can gain more context and perhaps come up with a better solution. For instance, creating a connect middleware for DocPad seems like a good way forward rather than passing in a server (ref #272)

Ben Harris

I'm using vhosts. Same as you seem to be thinking here https://github.com/balupton/nodechat.docpad/blob/master/server.coffee#L39

So essentially, I'm just passing 'request' events to the server. I can pass a middleware function to the vhost though, so that could work too.

Benjamin Arthur Lupton
Owner

As of DocPad v6.7, I can definitely say all the technical side is there. I've updated the docs to reflect this:
https://github.com/bevry/docpad/wiki/API

Benjamin Arthur Lupton balupton closed this October 01, 2012
Benjamin Arthur Lupton balupton referenced this issue from a commit October 02, 2012
Benjamin Arthur Lupton v6.7.0. Improvement.
- v6.7.0 October 2, 2012
	- Server changes:
		- Updated [Express.js](http://expressjs.com/) from v2.5 to v3.0
			- If you're doing custom routing, you'll want to check the
[Express.js Upgrade
Guide](https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to
-3.x)
			- There are now two server objects: `serverExpress` and `serverHttp`
- get them using `docpadInstance.getServer(true)`, set them using
`docpad.setServer({serverExpress,serverHttp})` - `server` in events,
and `docpadInstance.getServer()` return the `serverExpress` object for
backwards compatibility (however things like socket.io require the
`serverHttp` object)
			- Closes [#311](#311),
[#308](#308),
[#272](#272),
[#274](#274)
			- Help by [dave8401](https://github.com/dave8401) and [Ben
Harris](https://github.com/bharrisau)
		- Abstracted out the different middlewares to
`serverMiddlewareHeader`, `serverMiddlewareRouter`,
`serverMiddleware404`, and `serverMiddleware500`
		- Added the following options to the `server` actions:
			- `serverExpress` for a custom express.js server
			- `serverHttp` for a custom http server
			- `middlewareStandard` set it to `false` for us to not use any of
the standard middleware (body parse, method override, express router)
			- `middlewareBodyParser` set it to `false` for us to not add the
`bodyParser` middleware
			- `middlewareMethodOverride` set it to `false` for us to not add the
`methodOverride` middleware
			- `middlewareExpressRouter` set it to `false` for us to not add the
Express.js `router` middleware
			- `middleware404` set it to `false` for us to not add our `404`
middleware
			- `middleware500` set it to `false` for us to not add our `500`
middleware
		- Example API usage can be found
[here](https://github.com/bevry/docpad/wiki/API)
	- Added `standalone` attribute to files (defaults to `false`)
		- If you set to `true`, changes to the file will only cause
re-rendering of that file alone
	- Added a progress indicator during generation
		- Closes [#247](#247)
		- Help by [Bruno Héridet](https://github.com/Delapouite)
761229e
Benjamin Arthur Lupton balupton referenced this issue from a commit October 02, 2012
Benjamin Arthur Lupton v6.7.0. Improvement.
- v6.7.0 October 2, 2012
	- Server changes:
		- Updated [Express.js](http://expressjs.com/) from v2.5 to v3.0
			- If you're doing custom routing, you'll want to check the
[Express.js Upgrade
Guide](https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to
-3.x)
			- There are now two server objects: `serverExpress` and `serverHttp`
- get them using `docpadInstance.getServer(true)`, set them using
`docpad.setServer({serverExpress,serverHttp})` - `server` in events,
and `docpadInstance.getServer()` return the `serverExpress` object for
backwards compatibility (however things like socket.io require the
`serverHttp` object)
			- Closes [#311](#311),
[#308](#308),
[#272](#272),
[#274](#274)
			- Help by [dave8401](https://github.com/dave8401) and [Ben
Harris](https://github.com/bharrisau)
		- Abstracted out the different middlewares to
`serverMiddlewareHeader`, `serverMiddlewareRouter`,
`serverMiddleware404`, and `serverMiddleware500`
		- Added the following options to the `server` actions:
			- `serverExpress` for a custom express.js server
			- `serverHttp` for a custom http server
			- `middlewareStandard` set it to `false` for us to not use any of
the standard middleware (body parse, method override, express router)
			- `middlewareBodyParser` set it to `false` for us to not add the
`bodyParser` middleware
			- `middlewareMethodOverride` set it to `false` for us to not add the
`methodOverride` middleware
			- `middlewareExpressRouter` set it to `false` for us to not add the
Express.js `router` middleware
			- `middleware404` set it to `false` for us to not add our `404`
middleware
			- `middleware500` set it to `false` for us to not add our `500`
middleware
		- Example API usage can be found
[here](https://github.com/bevry/docpad/wiki/API)
	- Added `standalone` attribute to files (defaults to `false`)
		- If you set to `true`, changes to the file will only cause
re-rendering of that file alone
	- Added a progress indicator during generation
		- Closes [#247](#247)
		- Help by [Bruno Héridet](https://github.com/Delapouite)
b97db2d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.