Skip to content

Instantly share code, notes, and snippets.

@nsipplswezey
Last active June 12, 2016 03:26
Show Gist options
  • Save nsipplswezey/f6a50b92fadeeb4cbcf740d3120308e3 to your computer and use it in GitHub Desktop.
Save nsipplswezey/f6a50b92fadeeb4cbcf740d3120308e3 to your computer and use it in GitHub Desktop.
Nodal TL:DR Template
npm install -g nodal
nodal new <my-awesome-project>
cd <my-awesome-project>
nodal g:model <Awesome_Model> <user_id:int body:string json_field:json>
nodal g:controller --for <Awesome-Models>
nodal db:create
nodal db:prepare
nodal db:migrate
nodal s
// <comment/with/filepath.js>
// <comment/with/filepath.js>
Request:
POST to /endpoint
user_id : 1
body : Hello Nodal TL;DR
json_field : {"awesome":"true","magic":["Better","than","magic!"],"power":"9999"}
Response:
{
"meta": {
"total": 1,
"count": 1,
"offset": 0,
"error": null
},
"data": [
{
"id": 6,
"user_id": 1,
"tasks": {
"magic": [
"Better",
"than",
"magic!"
],
"power": "9999",
"awesome": "true"
},
"done": true,
"created_at": "2016-06-02T11:37:24.728Z",
"updated_at": "2016-06-02T11:37:24.735Z"
}
]
}
POST to /endpoint
{
"meta": {
"total": 1,
"count": 1,
"offset": 0,
"error": null
},
"data": [
{
"id": 1,
"user_id": 1,
"tasks": {
"magic": [
"Better",
"than",
"magic!"
],
"power": "9999",
"awesome": "true"
},
"done": true,
"created_at": "2016-06-02T11:37:24.728Z",
"updated_at": "2016-06-02T11:37:24.735Z"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment