ruby 2.5.1
bundle install
rails s
-
Specs
- rspec-rails
- factory_bot_rails
-
Application
- rack-cors (edit cors.rb to enable Cross-Origin Resource Sharing)
- jsonapi-resources
GET localhost:3000/api/v1/pages
--
POST localhost:3000/api/v1/pages Header Content-Type: application/vnd.api+json Accept: application/vnd.api+json
body
{
"data": {
"type": "pages",
"attributes": {
"content": "http://en.wikipedia.org/"
}
}
}
GET /api/v1/pages(.:format) api/v1/pages#index POST /api/v1/pages(.:format) api/v1/pages#create
ApplicationController extends from JSONAPI::ResourceController
I created a service caled PageWrapper that wrappers the extract url.
page_wrapper_spec.rb
Page with atribute 'content' (JSONB)
I use TDD to create my specs controllers, models and services
There is a folder named doc that contains the api documentation. You can open the index.html page in your browser to seet the complete documentation
./doc/api/index.html
create the spec/acceptance specs
Finaly I run the command below.
rake docs:generate