My-Todos is a basic API built with ruby's Sinatra DSL.
This project is a demo that shows the power of the DSL in building server-side applications quickly.
The application has been built with the MVC design pattern.
In order to use this repository you will need the following:
- Operating System (Windows
10+
, Linux3.8+
, or MacOS X10.7+
) - RAM >= 4GB
- Free Space >= 2GB
This application has been built with the following tools:
- Ruby
v2.7.+
- SQlite3
v1.6
- ActiveRecord
v7.0.4
- Rake
v13.0.6
- Puma
v6.1
- rerun
v0.14
- Sinatra
v3.0.5
- Bootstrap
v5.3.0
- ERB
v4.0
You can setup this repository by following this manual
- Clone the repository
git clone https://github.com/otsembo/my-todos-sinatra.git
- Ensure the ruby gems are setup in your machine
bundle install
- Perform any pending database migrations
rake db:migrate
- Run the application
rake start
- Open the application from your browser
http://localhost:9292
This application is a simple web API that allows users to:
- Register a new account.
- Log in to existing account.
- Create TODO items.
- Update individual TODO items.
- View all TODO items.
- Filter TODO items by date.
- Delete a TODO item.
Database schema definitions.
COLUMN | DATA TYPE | DESCRIPTION |
---|---|---|
id | Integer | Unique identifier. |
title | String | The name of the task. |
description | String | A short description about the task. |
due | Date | The set due date for the task. |
createdAt | Date | The date the task was created. |
status | ENUM [CREATED, ONGOING, COMPLETED, CANCELLED] |
TThe status of the task. |
COLUMN | DATA TYPE | DESCRIPTION |
---|---|---|
id | Integer | Unique identifier. |
full_name | String | User's full name. |
password_hash | String | User's password hashed with BCrypt . |
updated_at | Date | The date the user was updated. |
createdAt | Date | The date the user was created. |
-
/hello
- Presents a simple welcome message. -
/auth/register
- Create a new user account.## REQUEST BODY { "full_name": "John Doe", "email": "mail@mail.com", "password": "12345678" }
-
/auth/login
- Log in a user using email and password.## REQUEST BODY { "email": "mail@mail.com", "password": "12345678" }
-
/todos/create
- Add a new TODO item.## REQUEST BODY { "title": "Make Breakfast", "description": "Prepare milk and cereal", "due": "2023-09-09" }
-
/todos
- List all TODO items.## RESPONSE SAMPLE { "data": [ { "id": 2, "title": "Running another DSA practice 2", "description": "A wild desc", "due": "2023-02-24T00:00:00.000Z", "createdAt": "2023-02-24T09:34:41.856Z", "status": "CREATED" }], "message": "SUCCESS" }
-
/todos/update/:id
- Update an existing TODO. -
/todos/delete/:id
- Delete a TODO item. -
/
- Render a table of all todos using Bootstrap and ERB
This repository is distributed under the MIT License
Copyright 2023 Ian Okumu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This repository is maintained by: