API Server

At the heart of LightningUserVault lies our robust API server, designed to offer seamless interactions and efficient data operations. We've harnessed the power of the Gin Web Framework to ensure swift performance, easy route registration, and a developer-friendly experience.

🛣️ Endpoints

Our framework supports the following user routes:

userGroup := r.Group("/user")
{
    userGroup.GET("/:id", handler.GetHandler)
    userGroup.POST("/", handler.SetHandler)
}

🛡️ Middlewares

To ensure smooth operations and enhanced security, we've integrated the following middlewares:

  1. Metrics Monitoring: With the integration of ginmetrics, the server is equipped to monitor various metrics, providing insights into the application's performance and usage.

  2. CORS: The server uses the default CORS middleware to handle Cross-Origin Resource Sharing, ensuring that the API can be safely accessed from different origins, if configured.

  3. Logging: The gin.Logger() middleware is employed to log every request to the server, capturing essential details like method, endpoint, status code, and latency.

  4. Panic Recovery: In the event of a panic, the gin.Recovery() middleware ensures that the server doesn't crash. Instead, it captures the panic and logs the error, allowing for smooth operations.

  5. API Documentation with Swagger: To make it easier for developers to understand, test, and interact with the API, Swagger documentation is set up. This interactive documentation provides details about each endpoint, expected payloads, responses, and more. You can access this documentation at the /swagger/index.html endpoint.

By integrating these middlewares, LigningUserVault ensures a robust, secure, and developer-friendly API server.

⚙️ Configuration

To customize the server's address, use the following command:

  • SERVER_ADDRESS: Address for your web server. Default: 0.0.0.0:8080

Last updated