Skip to content

Instantly share code, notes, and snippets.

@mikeumus
Created March 22, 2013 16:17
Show Gist options
  • Save mikeumus/5222620 to your computer and use it in GitHub Desktop.
Save mikeumus/5222620 to your computer and use it in GitHub Desktop.
Figuring how to augment DocPad's POST handling to incorporate the fileupload argument.
# The fileupload module uses Express to handle the POST (https://github.com/domharrington/fileupload#usage):
app.post('/upload', fileupload, function(req, res) {}
# DocPad API tells that we can put DocPad atop a existing Express App:
# http://docpad.org/docs/api
# But it'd be nice if we could just do something closer to this:
server.post config.postUrl, fileupload, (req,res,next) ->
@mikeumus
Copy link
Author

server.post() can take that middle argument of fileupload once you include .middleware on var fileupload = require('fileupload').createFileUpload('/uploadDir').middleware

Pointed out thanks to @formula1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment