Skip to content

Instantly share code, notes, and snippets.

@DjebbZ
Created June 12, 2012 14:26
Show Gist options
  • Save DjebbZ/2917870 to your computer and use it in GitHub Desktop.
Save DjebbZ/2917870 to your computer and use it in GitHub Desktop.
Very basic test of docpad-plugin-rest
# To use this gist
# 1. Launch `docpad server`
# 2. Run this gist with `coffee <filename>.coffee`
# Require
request = require 'request'
# Request sent to local server, with a basic document
req =
url: 'http://localhost:9778'
body:
title: 'something'
content: 'Dummy content'
# Send the document to docpad's server
request.post req, (err,res,body) ->
throw err if err
if !err and res.statusCode === 200
console.log body
else
console.log 'The server didn't answer 200 (== OK)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment