Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odilson-dev/odin-kittens
This is a fast and straightforward project where i set up a Rails app to be a data-producing API…
https://github.com/odilson-dev/odin-kittens
odin-kittens restful-api ruby-on-rails
Last synced: 2 days ago
JSON representation
This is a fast and straightforward project where i set up a Rails app to be a data-producing API…
- Host: GitHub
- URL: https://github.com/odilson-dev/odin-kittens
- Owner: odilson-dev
- Created: 2024-01-05T01:41:30.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-06T17:12:12.000Z (10 months ago)
- Last Synced: 2024-05-17T15:26:42.027Z (6 months ago)
- Topics: odin-kittens, restful-api, ruby-on-rails
- Language: Ruby
- Homepage: https://www.theodinproject.com/lessons/ruby-on-rails-kittens-api
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kittens API 🐱
Kitten application to set up Rails to render data instead of HTML from The Odin Project.
[Link to lesson](https://www.theodinproject.com/lessons/ruby-on-rails-kittens-api#assignment-2)## Table of Content
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)## Features
- RESTful API: Able to request index and show actions of Kitten as json.
- Functional html interface that allows create, edit, and delete actions.## Installation
clone repository
```
git clone [email protected]:odilsoncode/odin-kittens.git
```install gems
```
bundle install
```migrate data
```
rails db:migrate
```## Usage
start server
```
rails s
```open in browser
```
localhost:3000
```### API interface
Before you continue, make sure you create a new kitten through the html page
```
require 'rest-client'
```To get index json response
```
json_response = RestClient.get("http://localhost:3000/kittens", accept: :json)
puts json_response.body
```To get show json response
```
show_json_response = RestClient.get("http://localhost:3000/kittens/1", accept: :json)
puts show_json_response.body
```