Last active
December 17, 2015 09:48
-
-
Save pfrazee/5589687 to your computer and use it in GitHub Desktop.
server controller dsl
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
(/ | |
var time = require('util/time.js'); | |
var validate = require('validators.js'); | |
var render = require('templates.js'); | |
/) | |
← Host: grimwire.com | |
→ Accept: text/html | |
←" (/ render.layout() /) | |
← * / | |
← Link: </>; rel=self current, | |
</profiles>; rel=collection; title=profiles | |
→ * /profiles | |
← Link: </profiles/{id}>; rel=item | |
→ GET / | |
→ Accept: { | |
- html | |
← 200 ok | |
← Content-Type: content+layout+html | |
←" <h1>Welcome to Grimwire.com</h1> | |
<p>The current time is (/ time.getDate() /)</p> | |
} | |
→ GET /profiles | |
→ Accept: { json } | |
|→ GET (/ request.getLink('appstorage').item('profiles') /) | |
|→ Accept: application/json | |
←|← (/ this /) | |
←|←" (/ this.body /) | |
→ {HEAD, GET} /profiles | |
← 200 ok | |
→ POST /profiles | |
→ Accept: { json, html } | |
→ Content-Type: { json } | |
→ POST /profiles | |
"→ (/ !validate.profile(this) /) | |
← 422 bad content | |
→ Accept: { | |
- html | |
← Content-Type: content+layout+html | |
←" (/ render.profileEditor(request) /) | |
- --- | |
← Content-Type: application/json | |
←" (/ request.errors /) | |
} | |
→ POST /profiles | |
|→ POST (/ request.getLink('appstorage') /) | |
|→ Content-Type: application/json | |
|"→ (/ request.body /) | |
| | |
|← 201 | |
|→ PUT (/ request.getLink('appstorage').item('user') /) | |
|→ Content-Type: application/json | |
|"→ {"lastCreate": (/ time.getDate() /)} | |
←|← 201 created | |
→|→ Accept: { | |
| - html | |
←| ← Content-Type: content+layout+html | |
←| ←" <h1>Profile Created</h1> | |
| - json | |
←| ← Content-Type: application/json | |
←| ←" {"result":"Profile Created"} | |
| } | |
| | |
|← Status: (/ this != 201 /) | |
←|← 502 upstream error | |
|←" (/ var upstreamBody = this /) | |
←|←" (/ upstreamBody /) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment