This is a simple RESTful API for tracking users and their tasks. It is built with Ruby on Rails.
It also has a frontend repository built using React https://github.com/Sammy-CK/task-taker
We have two models: User and Task.
https://task-201f.onrender.com
The following relationships have been established:
-
A
Userhas manyTasks -
A
Taskbelongs to aUser.
In User model:
usernamemust be more than five and less than eight characters
In Task model:
descriptionmust be present and at least 20 characters long
In Task model:
titlemust be present and at least 5 characters long and maximum 20 characters long
Routes
The following routes have been set up:
- POST
/users: Register a user - POST
/users/login: Returns information about a specific user and creates a new session - DELETE
/users/logout: Deletes a session of the user. - GET
/user/login/check: Ensures users session is still valid and logged in - POST
/todos: Creates an instance of Task for the specific user. - PUT
/todos/:id: Updates an instance of Task for the specified user - DELETE
/todos/:id: Deletes an instance of Task for the specified user - GET
/todos: Returns instances of Task for the specified user
Errors
If a request is made with invalid parameters, the API will respond with a JSON error message.
If a request is made to incorrect resources, the API will respond with a JSON error message.
This project was built with the following tools:
- Ruby on Rails
Documentation on the Ruby language can be found here: Ruby Docs
In order to use this repo you need to have the following installed:
- OS [either: Windows 10+, Linux or MacOS(running on x86 or arm architecture)]
- Ruby - 3.1.+
To use this repo on your machine requires some simple steps
-
Open a terminal / command line interface on your computer
-
Clone the repo by using the following:
git@github.com:Sammy-CK/task-backend.git -
Be patient as it creates a copy on your local machine for you.
-
Change directory to the repo folder:
cd task-backend -
(Optional) Open it in
Visual Studio Codecode . -
(Alternate Option) Open it in any editor of your choice.
-
On the top right corner of this page there is a button labelled
Fork. -
Click on that button to fork the repo to your own account.
-
Take on the process in
Alternative Oneabove. -
Remember to replace your username when cloning.
git clone https://github.com/your-username-here/task-backend
Running the application is very straight forward. You can use the following steps to run the app.
-
Install required gems
bundle install -
Migrate the tables onto the database
rails db:migrate -
Run the application on the terminal
rails server -
The API can then be accessed using a tool like Postman.
This project was contributed to by:
The project is licensed under Apache 2.0.
