grape-on-rails icon indicating copy to clipboard operation
grape-on-rails copied to clipboard

Sample Grape API mounted on Rails.

Grape on Rails

Test Code Climate

A Grape API mounted on Rails.

  • ping: a hello world GET API
  • post: post JSON data
  • raise: raise an error, Rails handling exceptions
  • protected: API protected with rudimentary Basic Authentication
  • headers: demonstrates header handling

See

An instance of this app is running on grape-on-rails.herokuapp.com.

Run

bundle install
rails s

Try http://localhost:3000/api/ping or http://localhost:3000/api/protected/ping with username and password.