GithubHelp home page GithubHelp logo

ticket-system's Introduction

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.

ticket-system's People

Contributors

thanhliemtu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.