How thanhchuong0410/interview works
Project Type and Purpose
• This is a Go-based backend microservice (RESTful API server) built with the Gin framework.
• Its primary function is to expose CRUD and custom‐search endpoints for tables like products, suppliers, categories, plus an export feature.
• It serves HTTPS on port 8080 with a static token-based authentication middleware and provides Swagger docs.
File Structure
• Top-level:
• main.go – application entry point, starts Gin HTTP server with TLS.
• go.mod/go.sum – module dependencies.
• README.md – setup and API documentation.
• output.pdf – probably generated API report or example.
• Directories:
• app/ – model definitions (model_base, model_categories, model_products, etc.).
• authentication/ – custom token check middleware.
• cert/ – TLS certificate and key.
• config/ – configuration loader (config.go).
• database/ – database connection logic (database.go).
• docs/ – Swagger definitions (swagger.json/yaml) and docs.go stub.
README for Additional Insights
• Uses gin in HTTPS mode: [GIN-debug] Listening and serving HTTPS on :8080.
• Token auth via Authorization header.
• API routes under /api namespace; methods: POST for custom_search and updates, GET for records.
• Returns structured JSON with data, message, metadata, status.