Code Monkey home page Code Monkey logo

api-only-todos's Introduction

API Todo app

  • Ruby - v3.0.0

  • Rails - v6.1.4

Install all gems:

bundle install

Run migrations:

bin/rails db:migrate

Seed the database:

bin/rails db:seed

Run the test suite:

bundle exec rspec

Start the rails server

bin/rails s

it will be available on http://localhost:3000

Usage

The API is versioned. Currently, it's V1 which is also the default.

  • Sign up a new user
http :3000/signup name=foo [email protected] password=foobar password_confirmation=foobar

When you sign up, you will be able to get the auth token from the output of the above command. Alternatively, you can get the auth token by running:

http :3000/auth/login [email protected] password=foobar
  • Create a todo
http POST :3000/todos title=foo \
Authorization:'eyJhbGciOiJIUzI1NiJ...'
  • View all of your todos
http :3000/todos Accept:'application/vnd.todos.v1+json' Authorization:'eyJhbGciOiJIUzI1NiJ...'

The API has pagination, it shows 20 results per page. If you wish you can view specific pages by editing the page parameter.

http :3000/todos page==1 Accept:'application/vnd.todos.v1+json' Authorization:'eyJhbGciOiJIUzI1NiJ...'
  • Add an item to a todo
http POST :3000/todos/id/items name='foo baz' done=false Accept:'application/vnd.todos.v1+json' Authorization:'eyJhbGciOiJIUzI1NiJ...'

api-only-todos's People

Contributors

danshock avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.