https://github.com/ruby-grape/grape-on-rails
Sample Grape API mounted on Rails.
https://github.com/ruby-grape/grape-on-rails
Last synced: about 1 year ago
JSON representation
Sample Grape API mounted on Rails.
- Host: GitHub
- URL: https://github.com/ruby-grape/grape-on-rails
- Owner: ruby-grape
- Created: 2013-02-10T14:31:40.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2025-03-22T15:16:35.000Z (about 1 year ago)
- Last Synced: 2025-04-13T04:59:46.884Z (about 1 year ago)
- Language: Ruby
- Size: 180 KB
- Stars: 174
- Watchers: 4
- Forks: 56
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Grape on Rails
[](https://github.com/ruby-grape/grape-on-rails/actions/workflows/test.yml)
[](https://github.com/ruby-grape/grape-on-rails/actions/workflows/test.yml)
[](https://codeclimate.com/github/ruby-grape/grape-on-rails)
A [Grape](http://github.com/ruby-grape/grape) API mounted on Rails.
- [ping](app/api/acme/ping.rb): a hello world `GET` API
- [post](app/api/acme/post.rb): post JSON data
- [raise](app/api/acme/raise.rb): raise an error, Rails handling exceptions
- [protected](app/api/acme/protected.rb): API protected with rudimentary Basic Authentication
- [headers](app/api/acme/headers.rb): demonstrates header handling
## Run
```
bin/setup
rails s
```
- Try http://localhost:3000/api/ping or http://localhost:3000/api/protected/ping with _username_ and _password_.
- View Swagger docs at http://localhost:3000/swagger.