Code Monkey home page Code Monkey logo

fswd-todolist's Introduction

To Do List Full-stack

This is a To Do list full-stack application. It has a user table and a task table. And a front-end that consumes the API.

API endpoints

Before you start, create a new user account by sending a post request to '/users'. It will return an object like this:

{ success: true, id: 1 }

The id will be your api_key for making requests to the following tasks endpoints.

Tasks

URI Type Description Request Body Sample Response
api/tasks?api_key=your_user_id GET Returns an object with a tasks property that contains an array of tasks belonging to you. N/A
{
  tasks: [
    { id: 1,
      content: 'A to do list task',
      complete: 'false',
      due: datetime,
      updated_at: datetime,
      created_at: datetime
    },
    { id: 2,
      content: 'Another to do list task',
      complete: 'true',
      due: datetime,
      updated_at: datetime,
      created_at: datetime
    },
  ]
}
api/tasks?api_key=your_user_id POST Creates a new task under your user account.
{
  task: {
    content: 'This is a task',
    due: 'Sat Oct 21 2017
    14:05:00 GMT+0800 (HKT)'
  }
}
{
  task: {
    id: 1,
    content: 'This is a task',
    complete: 'false',
    due: '2017-10-21T06:01:02.000Z',
    created_at: '2017-10-21T06:00:07.065Z'
  }
}
api/tasks/:id?api_key=your_user_id PUT Update the content or due time of the task specified by id.
{
  task: {
    content: 'This is not a task',
    due: 'Sat Oct 21 2017
    14:09:38 GMT+0800 (HKT)',
  }
}
{
  task: {
    id: 1,
    content: 'This is not a task',
    complete: 'true',
    due: '2017-10-21T06:09:38.000Z',
    created_at: '2017-10-21T06:00:07.065Z',
    updated_at: '2017-10-21T06:09:54.730Z'
  }
}
api/tasks/:id/mark_complete?api_key=your_user_id PUT Mark the complete property to true for the task specified by id. N/A
{
  task: {
    id: 1,
    content: 'This is a task',
    complete: 'true',
    due: datetime,
    created_at: DateObject,
    updated_at: DateObject
  }
}
api/tasks/:id/mark_active?api_key=your_user_id PUT Mark the complete property to false for the task specified by id. N/A
{
  task: {
    id: 1,
    content: 'This is a task',
    complete: 'false',
    due: datetime,
    created_at: DateObject,
    updated_at: DateObject
  }
}
api/tasks/:id?api_key=your_user_id DELETE Delete the task specified by id. N/A
{
  success: true
}

Datetime

Datetime objects are stored in UTC time.

Front-end App

The To Do List front-end is located at root /. It uses the user id 1 to make requests.

Running the server locally

After downloading the repository Install the gems

bundle

Create the database

rails db:create

Migrate the database

rails db:migrate

Seed the database

rails db:seed

Start server:

rails s

Visit localhost:3000 to see the To Do List.

fswd-todolist's People

Contributors

samorey11 avatar h8rry avatar xiaopow 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.