Everybody is an application interface created in Ruby for the implementation of a web service. You can use a UI such as Postman or RestEasy to feed a Database. This Api is exclusive to develop a Blog.
$ git clone https://github.com/DanielArturoAlejoAlvarez/everybody.git [NAME APP]
Follow the following steps and you're good to go! Important:
Install packages:
Genfile:
$ gem install mysql2
$ gem install faker
$ gem install friendly_id
$ bundle install
CREATE DATABASE [name database];
***(Implement config/database.yml) mysql2
$ rails g model Post title:string body:text slug:string
$ rake db:migrate
$ rails s
module Api
module V1
class PostsController < ApplicationController
def index
posts = Post.all.order("created_at DESC")
render json: {status: 'SUCCESS', msg: 'Loaded Posts', data:posts}, status: :ok
end
...
private
def post_params
params.require(:post).permit(:title, :body, :slug)
end
end
end
end
class Post < ApplicationRecord
validates :title, presence: true
validates :body, presence: true
extend FriendlyId
...
end
...
namespace 'api' do
namespace 'v1' do
resources :posts
end
end
...
Bug reports and pull requests are welcome on GitHub at https://github.com/DanielArturoAlejoAlvarez/everybody. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.