https://github.com/firewalker06/pondasi
A Grape experiment with Rails. See Grape: http://intridea.github.io/grape
https://github.com/firewalker06/pondasi
Last synced: about 1 year ago
JSON representation
A Grape experiment with Rails. See Grape: http://intridea.github.io/grape
- Host: GitHub
- URL: https://github.com/firewalker06/pondasi
- Owner: firewalker06
- Created: 2015-02-18T12:50:59.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-18T13:14:29.000Z (over 11 years ago)
- Last Synced: 2023-03-11T20:27:50.674Z (over 3 years ago)
- Language: Ruby
- Size: 137 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
A very simple application using Grape in Rails.
This example defines API inside `Pondasi::APITest` that created by subclassing `Grape::API`. Please see `app/api/pondasi/api.rb` for more information.
## Installing
```
$ git clone https://github.com/firewalker06/pondasi.git
$ cd pondasi
$ bundle install
```
## Running
```
$ rails s
```
## Example
```
$ curl -X POST -H "Content-Type: application/json" http://localhost:3000/api/posts -d '{ "title": "This is new post", "description": "That describe something" }'
{"id":1,"title":"This is new post","description":"That describe something","created_at":"2015-02-18T13:02:56.798Z","updated_at":"2015-02-18T13:02:56.798Z"}
$ curl -X GET -H "Content-Type: application/json" http://localhost:3000/api/posts
[{"id":1,"title":"This is new post","description":"That describe something","created_at":"2015-02-18T13:02:56.798Z","updated_at":"2015-02-18T13:02:56.798Z"}]
$ curl -X PATCH -H "Content-Type: application/json" http://localhost:3000/api/posts/1 -d '{ "title": "Updating title" }'
true
$ curl -X GET -H "Content-Type: application/json" http://localhost:3000/api/posts/1
{"id":1,"title":"Updating title","description":null,"created_at":"2015-02-18T13:02:56.798Z","updated_at":"2015-02-18T13:04:24.571Z"}
$ curl -X DELETE -H "Content-Type: application/json" http://localhost:3000/api/posts/1
{"id":1,"title":"Updating title","description":null,"created_at":"2015-02-18T13:02:56.798Z","updated_at":"2015-02-18T13:04:24.571Z"}
$ curl -X GET -H "Content-Type: application/json" http://localhost:3000/api/posts
[]
```
## Contributing
Want to contribute? Great!
1. Fork it.
2. Create a branch (`git checkout -b improve_readibility`)
3. Commit your changes (`git commit -am "Change my contact lense"`)
4. Push to the branch (`git push origin improve_readibility`)
5. Open a [Pull Request](https://github.com/firewalker06/pondasi/pulls)
6. Enjoy a refreshing Diet Coke and wait