Created
June 12, 2012 14:26
-
-
Save DjebbZ/2917870 to your computer and use it in GitHub Desktop.
Very basic test of docpad-plugin-rest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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