π Table of Contents
The task management API provides a RESTful interface for managing tasks within an application. Users can perform various operations on tasks, including creating, reading, updating, and deleting tasks. The API supports user authentication using JWT tokens to ensure secure access to task data. Tasks are stored in a database, and input data is validated to maintain data integrity and security. The API facilitates seamless integration with client applications, enabling users to efficiently organize and track their tasks.
Client
Ruby on Rails:
- [user authentication]
- [api for student information]
Before you begin, ensure you have the following:
- Ruby (version 3.1.1)
- Ruby on Rails (version 7.1)
- PostgreSQL
- Git
- Postman
Follow these steps to install and configure the student_dashboard_api Rails App:
- git clone git@github.com:david30-maker/task-management-app.git
- cd task-management-api
- bundle install
- rails db:create
- rails db:migrate
- rails db:seed
- rails server
π€ David Igbo
- GitHub: @david30-maker
- Twitter: @davidigbo1
- LinkedIn: davidigbo/
- Department Api
Contributions, issues, and feature requests are welcome!
Give a start βοΈ If you like this project...
Special thanks to Niyo Group for this opportunity
This project is MIT licensed.
Now the server is running you can start to query the API endpoints.
To Sign up a user, send a POST request to the following endpoint;
http://localhost:3000/signup
The body of the Json will be
{
"user": {
"email": "david@gmail.com",
"password": "1234567",
"name": "Dave"
}
}
If you do this right , you will get a response of the created user
{
"status": {
"code": 200,
"message": "Signed up successfully."
},
"data": {
"id": 6,
"email": "david@gmail.com",
"name": "Dave"
}
"token": "eyJhbG*********************************************************nRVvhI"
}
If you do this wrong , you will get an error message:
{
"error": "User couldn't be created successfully"
}
After signing up;
Copy the token in the response body of the previous successful request
Send a GET request to the following endpoint to get details on the signed up user
`http://localhost:3000/signup`
On the headers for the request add `Authorization` using the keyword `Bearer` , followed by the token you got upon signing up
The Authorization Header should look like this
```json
"Authorization": "Bearer eyJhbG*********************************************************nRVvhI"
We will get this as the response body
{
"status": {
"code": 200,
"message": "Signed up successfully."
},
"data": {
"id": 6,
"email": "david@gmail.com",
"name": "Dave"
}
}
To handle login , send a POST request to the following endpoint
http://localhost:3000/login
and the body below
{
"user": {
"email": "david@gmail.com",
"password": "1234567"
}
}
We get this as the response body
{
"status": {
"code": 200,
"message": "Logged in successfully.",
"data": {
"user": {
"id": 6,
"email": "david@gmail.com",
"name": "Dave"
}
}
}
"token": "eyJhbG*********************************************************nRVvhI"
}
If you do this wrong , you will get an error message:
{
"error": "Logged in was not successfully"
}
To handle task api, send a POST request to the following endpoint
http://localhost:3000/api/v1/tasks
and the body below
{
"task": {
"title": "Relationships matter",
"description": "It is an awesome book on relationship",
"status": "in_progress"
}
}
We get this as the response body
{
"id": 17,
"title": "Relationships matter",
"description": "It is an awesome book on relationships",
"status": "in_progress",
"completed": false,
"user_id": 6,
"created_at": "2024-05-20T06:34:31.777Z",
"updated_at": "2024-05-20T06:34:31.777Z"
}
If you do this wrong, you will get an error message:
{
"error": "Task was not created"
}