Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/connor4312/flake
A fake Node.js daemon
https://github.com/connor4312/flake
Last synced: about 2 months ago
JSON representation
A fake Node.js daemon
- Host: GitHub
- URL: https://github.com/connor4312/flake
- Owner: connor4312
- Created: 2014-05-18T23:46:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-19T01:18:42.000Z (over 10 years ago)
- Last Synced: 2024-10-25T22:20:26.780Z (2 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# flake
Flake is a daemon to mimic your yet-to-be-built or wired in daemon. It takes a markdown file full of route and request info and returns responses based off that. In fact, this very file is a valid Flake definitions file! So let's define some stuff.
#### What this does:
![What we're making](http://puu.sh/8RWIV/315721740f.png)### Get the info on `GET /api/info`!
To start a "section", create a title with pound signs. In that title, have a string in the format `ACTION PATH` (including the backticks). Everything else in the title is ignored. And, of course, any content in the readme (such as this content!) will be ignored.
```json
{
"author": "Connor Peet",
"package": "flake"
}
```We just defined a response! Now, whenever you send a GET request to `/api/info`, that JSON up there can be returned. It doesn't have to be JSON, of course, it can be anything you'd like.
### Let's make another route `POST /api/cookies`
You can also define specific requests and responses to those requests by creating a title called "request" or "response". For example, this route will only respond to:
#### Request
```json
{
"type": "Macadamia Nut",
"to": "connor4312"
}
```#### Response
You can make your own response. Note that you can define a route multiple times with multiple different requests and responses!
```
Your cookie delivery is on the way!
```