Skip to content

thanhliemtu/Ticket-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Axum Ticket System

This is a simple ticket system built using the Rust Axum framework. The system provides endpoints for user authentication, ticket creation, listing all tickets, and deleting tickets.

Routes

1. Authentication

POST /api/login

  • Handles user authentication through a POST request.
  • Hardcoded username and password for now.
  • Upon successful login, a cookie is assigned to the user.

2. Ticket Management

POST /api/tickets

  • Creates a new ticket through a POST request.
  • Requires authentication (cookie check).

GET /api/tickets

  • Retrieves a list of all tickets on the server.
  • Requires authentication (cookie check).

DELETE /api/tickets/:id

  • Deletes a ticket with the specified ID through a DELETE request.
  • Requires authentication (cookie check).

Middleware

  • All endpoints under "/api/tickets" are layered with a middleware that ensures authentication.
  • Authentication is verified by checking for the existence of a valid cookie, which is obtained after a successful login from "/api/login".

Error Handling

All routes in the system are equipped with a middleware that maps server errors to client errors. This middleware ensures that confidential information is logged on the server side without revealing any sensitive details to clients.

Implementation Details

  • The error handling middleware intercepts server errors and transforms them into client-friendly error responses.
  • Confidential information is logged on the server for debugging purposes without exposing it to clients.

Logging

  • Server-side logs capture detailed information about errors for troubleshooting.
  • Ensure that sensitive information is appropriately redacted or masked in the logs.

Tutorial

For a detailed tutorial on building this ticket system with Rust Axum, check out the video tutorial:

Rust Axum Tutorial

Original Repository

The original repository for this project can be found on GitHub.

License

This project is dual-licensed under the MIT License and the Apache License 2.0. See the MIT LICENSE and APACHE LICENSE files for details.

About

Rust Axum framework

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages