Originally, I only had 2 days to finish this project and my lack of experience didn't allow me to make a good frontend so I'm figuring out what solution I should use, HTMX or React, at the moment. The frontend was a simple index.html file with a script tag at the bottom and javascript to fetch and display data.
This was a project to get selected for a 2-month long unpaid internship. I got selected.
Since this web application is just a backend made with Rust which serves an HTML, the whole application is just a binary executable.
Go to the Releases section of this repository to download the executable.
https://github.com/flakelolz/management-app/releases/
Otherwise, you can build it from source if you have Rust and cargo (Rust's toolchain) installed. For that you'll need to:
- Go to Rust's main page - https://www.rust-lang.org/learn/get-started
- Download and install
Rustupto get the Rust toolchain - Download the source code of this repository
- In your terminal, navigate to the backend folder (Where the
cargo.tomlis) - Run the
cargo runcommand in your CLI to run the backend
For the frontend, it still working from an html file served by the backend
This is an example for management app that deals with employees and projects for a company. The main page is located on http://localhost:3001/.
On the main page you add employees or projects, click an employee or project on their respective lists and update information or delete them.
For the APIs there's the following endpoints:
http://localhost:3001/employeeshttp://localhost:3001/projectshttp://localhost:3001/employees/:employee_idhttp://localhost:3001/projects/:project_idhttp://localhost:3001/taskshttp://localhost:3001/tasks/:task_idhttp://localhost:3001/tasks/employee/:employee_idhttp://localhost:3001/tasks/project/:project_idhttp://localhost:3001/tasks/employee/employee_id/not
With this endpoints you can perform CRUD operations from a tool that allows you to send request like https://hoppscotch.io/
The following API requests are valid:
GETto/employees,/projectsor/taskswill return a list of all the respective items in the database.GETto/employees/:id,/projects/:idor/tasks:idwill return the item that matches theidpassed through the URL.POSTto/employees,/projectsor/taskswill create a new item when paired with aJSONpayload.- For employees the JSON will need
name: string - For projects the JSON will need
name: string - For tasks the JSON will need
project_id: intandemployee_id: int
- For employees the JSON will need
PUTto/employees/:id,/projects/:idor/tasks:idwill update the information of the item that matches theidgiven. Send a JSON payload with the new information.- For employees the JSON will need
name: string - For projects the JSON will need
name: string - For tasks the JSON will need
project_id: intandemployee_id: int
- For employees the JSON will need
DELETEto/employees/:id,/projects/:idor/tasks:idwill delete the item that matches theidgiven.GETto/tasks/employee/:employee_idwill return all the projects (tasks) assigned to the employee ID given.GETto/tasks/project/project_idwill return all the employees (tasks) assigned to the project ID given.
I used SQLite in memory, which means that everything added from the API after the app is running is not gong to remain after the app is closed.
If you wish to add data in a more permanent way, you can do so by writing the queries on the sql file inside the migrations folder.
