Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Readme

  • Loading branch information...
commit 5ba951c5b1c262723c19ee1ee0541a5cac8a1ee0 1 parent 45c8770
@niclashoyer authored
Showing with 85 additions and 0 deletions.
  1. +85 −0 Readme.md
View
85 Readme.md
@@ -0,0 +1,85 @@
+# Copperhead
+
+## Installation
+
+```plaintext
+npm install copperhead
+```
+
+## Usage
+```coffeescript
+connect = require 'connect'
+http = require 'http'
+
+router = require 'copperhead'
+
+app = connect()
+app.use connect.logger 'dev'
+app.use router
+
+router.get '/foo', ->
+ 'bar!'
+
+router.get ->
+ 'Hello World!'
+
+router.get 'application/json', ->
+ hello: "World!"
+
+router.get 'text/html', ->
+ '<!DOCTYPE html><html><head><title>Hello World!</title></head><body></body>Hello!</html>'
+
+app.listen 3000
+```
+
+### Available Methods
+
+#### HTTP 1.1
+
+ * get
+ * post
+ * put
+ * delete
+ * options
+ * patch
+
+#### WebDAV
+
+ * connect
+ * trace
+ * copy
+ * lock
+ * mkcol
+ * move
+ * propfind
+ * proppatch
+ * unlock
+ * report
+ * mkactivity
+ * checkout
+ * merge'
+
+#### Custom
+
+Use `router.route` to create a custom route.
+`route` takes the arguments
+
+ * method
+ * path
+ * mimetype
+ * middleware
+
+```coffeescript
+app = connect()
+app.use connect.logger 'dev'
+app.use router
+
+router.route 'custom', '/', '*/*', ->
+ "I'm custom!"
+
+app.listen 3000
+```
+
+## Similar Projects
+
+ * [Route66](https://github.com/vdemedes/route66)
Please sign in to comment.
Something went wrong with that request. Please try again.