docpad & custom routes

166 views
Skip to first unread message

David Steinberger

unread,
Sep 11, 2012, 5:44:52 PM9/11/12
to doc...@googlegroups.com
Hi,
I'm wondering how I can register routes that are not handled by docpad in docpad.coffee?
I'm playing around with node.js and want to integrate some login/logout functionality, but can't figure it out. Any idea how to get started?

Thanks,
  David

Benjamin Lupton

unread,
Sep 13, 2012, 2:11:41 AM9/13/12
to doc...@googlegroups.com
Hey David,

You can use the `serverExtend` event inside your `docpad.coffee` configuration file to get access to the Express.js server instance that DocPad uses. From there you can extend it to do your bidding. Most of the skeletons already include this by default, however personally I prefer to outsource such routing into it's own file - example here: https://gist.github.com/3695936

Let me know how you go, and feel free to jump onto IRC if you need any quick help. #docpad on freenode.

Cheers,
- Benjamin
Reply all
Reply to author
Forward
0 new messages