Skip to content

aadi58002/rust-axum-todo-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Todo Backend

Technologies Used

Getting Started

Database

Credits to GitHub - khezen/compose-postgres: Postgresql & pgadmin4 powered by compose for providing the docker-compose to setup pgadmin and postgres. To start the postgres database and the pgadmin utility

podman-compose up -d

The above command will automatically download the relevent image and start the database on port 5432 and the pgadmin ui on the port 5050. To use pgadmin effectively refer :- How to use pgAdmin. A brief overview & tutorial to connect Some pgadmin Screenshots

Infomation required to use pg admin

NameValue (Case sensitive)Docker-compose Variable Name
Master passwordrootPGADMIN_DEFAULT_PASSWORD
Register Server:- Name<Anything you want>
Host Name/addresspostgres
UsernamerootPOSTGRES_USER
PasswordrootPOSTGRES_PASSWORD

Scheme for database

User
NameTypeAttributeRelation
idi32Auto increment,Primary key
usernameStringrequired,uniqueTasks(username)
emailStringrequired
passwordStringrequired
Tasks
NameTypeAttributeRelation
idi32Auto increment,Primary key
usernameStringrequiredTaken from User(username)
titleStringrequired,Primary key
descriptionStringOptional
statusEither C or POptional -> Default to P (Pending)
(C = Completed)
(P = Pending)

Axum api server

Getting started - Rust Programming Language To start the axum server just install rust with above link. Then just run cargo run to start the server. The api will start running at

Api End points

Test Route for server status

RouteHeader (case sensitive)Function
/-It is just to see if the serrver is online and working as intended

Table actions

RouteHeader (case sensitive)Function
/tableaction = initIt will create the User and Tasks table in the database if not already there
/tableaction = dropIt will drop the User and Tasks tables along with there data
/tableaction = clearIt will clear the Data from the table but will leave the tables in the database(In sql terms TRUNCATE)

Users actions

RouteHeader (case sensitive)Function
/usersaction = register, username = <anything>, password = <anything>, email = <anything>It is used to register a new user
/usersaction = login , username = <anything>, password = <anything>It is used to check if a username has the correct password for the provided user name
/usersaction = delete , username = <anything>, password = <anything>It is used to delete a registerd user
/usersaction = update , username = <anything>, password = <anything>, changed_email = <if want to change>, changed_password = <Changed password>It is used to update the user credentials on the database (changed_password and changed_email)

Tasks actions

RouteHeader (case sensitive)Function
/tasksaction = get , username = <anything>, password = <anything>It will get all the tasks for the provided user
/tasksaction = add , username = <anything>, password = <anything>, title = <anything>, description = <if you want to have a description>It will add a new task for the provided user
/tasksaction = delete , username = <anything>, password = <anything>, title = <anything>It will delete task with the provided title for the provided user
/tasksaction = update , username = <anything>, password = <anything>, title = <anything>It will update the field which are available in the changed fields tasks for the provided user
changed_title = <if want to change>, changed_description = <if want to change>, changed_status = <if want to change>(Should be string of value “P” or “C”)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages