{"id":25998796,"url":"https://github.com/pol-cova/minimal_api","last_synced_at":"2025-09-04T05:16:15.112Z","repository":{"id":264437429,"uuid":"893373433","full_name":"pol-cova/minimal_api","owner":"pol-cova","description":"An open-source microframework built on top of fasthttp for high-performance","archived":false,"fork":false,"pushed_at":"2024-12-12T08:44:02.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T17:45:40.367Z","etag":null,"topics":["api","backend","golang","microframework"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pol-cova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-24T09:16:13.000Z","updated_at":"2025-02-02T00:43:14.000Z","dependencies_parsed_at":"2025-03-05T17:39:06.753Z","dependency_job_id":"2dc81eaa-0765-4419-a710-8d48661c641f","html_url":"https://github.com/pol-cova/minimal_api","commit_stats":null,"previous_names":["pol-cova/minimal_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pol-cova/minimal_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pol-cova%2Fminimal_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pol-cova%2Fminimal_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pol-cova%2Fminimal_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pol-cova%2Fminimal_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pol-cova","download_url":"https://codeload.github.com/pol-cova/minimal_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pol-cova%2Fminimal_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273555459,"owners_count":25126316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","golang","microframework"],"created_at":"2025-03-05T17:38:56.329Z","updated_at":"2025-09-04T05:16:15.104Z","avatar_url":"https://github.com/pol-cova.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# minimal_api\n\n**minimal_api** is a lightweight and high-performance microframework written in Go, designed to facilitate the creation of minimalist APIs. Its design is inspired by frameworks like Flask and FastAPI, but built to leverage the speed of `fasthttp`.\n\nThis project combines simplicity and efficiency, offering an easy experience for developers seeking speed and flexibility in their applications.\n\n---\n\n## Main Features\n\n- **Ultra-fast**: Built on `fasthttp`, it offers superior performance for handling HTTP requests.\n- **Clean and simple API**: Define routes, middlewares, and handlers intuitively.\n- **Middlewares**: Support for global and route-specific middlewares.\n- **Graceful shutdown**: Proper handling of system signals to safely stop the server.\n- **Modular code**: Separation of responsibilities between the server and the router to facilitate scalability.\n\n---\n\n## Installation\n\n1. **Clone the repository**:\n\n   ```bash\n   git clone https://github.com/pol-cova/minimal_api.git\n   cd minimal_api\n   ```\n\n2. **Install dependencies**:\n\n   Make sure you have Go 1.18 or higher installed and run:\n\n   ```bash\n   go mod tidy\n   ```\n\n3. **Run the server**:\n\n   ```bash\n   go run main.go\n   ```\n\n---\n\n## Basic Example\n\nThis example shows how to use `minimal_api` to set up a simple server with routes and middlewares:\n\n```go\npackage main\n\nimport (\n   \"github.com/pol-cova/minimal_api/mapi\"\n)\n\nfunc main() {\n   app := mapi.NewApp()\n\n   app.UseLogger()\n\n   app.GET(\"/api\", func(c *mapi.Context) {\n      c.Response.SetBodyString(\"Hello, from minimal API\")\n   })\n\n   app.POST(\"/api\", func(c *mapi.Context) {\n      c.Response.SetBodyString(\"Hello, from POST\")\n   })\n\n   app.Run(\"127.0.0.1:5000\")\n}\n```\n\n### Test the Server\n\n- Visit [http://localhost:8080/api](http://localhost:8080/) to see the welcome message.\n- Visit [http://localhost:8080/api](http://localhost:8080/protegido) to test a POST route.\n\n---\n\n## How to Stop the Server\n\nThe server is designed to shut down safely when it receives an interrupt signal.\n\n1. Start the server normally:\n\n   ```bash\n   go run main.go\n   ```\n\n2. Stop the server by pressing `Ctrl+C` in the terminal. You will see a message like:\n\n   ```\n   Shutting down server...\n   Server gracefully stopped\n   ```\n\n---\n\n## Project Structure\n\n```plaintext\nminimal_api/\n|--mapi/\n   ├── app.go         // Main file to start the server\n   ├── server.go      // Main server logic\n   ├── router.go      // Route and middleware management\n   ├── context.go     // Request and response context\n   ├── response.go    // HTTP response handling\n   ├── request.go     // HTTP request handling\n   ├── logger.go      // Request logging middleware\n   |--middleware.go   // Middleware definitions\n   |--template.go     // Template for server-side HTML\n   |--static.go       // Static file handling\n\n├── go.mod            // Project dependencies\n├── go.sum            // Dependency hashes\n```\n\n---\n\n## Future Features\n\n1. **minicli**: Command-line tool to generate projects and control the server.\n2. **Documentation**: Improve documentation and examples to facilitate API usage.\n3. **Performance**: Optimize server performance and efficiency.\n\n## Contributions\n\nYou are welcome to contribute! Here are some ways to do so:\n\n1. **Report bugs**: Open an [issue](https://github.com/pol-cova/minimal_api/issues) for problems or questions.\n2. **Improve the code**: Submit a pull request with new features or fixes.\n3. **Document**: Help improve the documentation with additional examples or guides.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n\n---\n\nIf you need help, feel free to create an issue in the repository or contact me directly. Thank you for your interest in minimal_api!\nContact: **polc394@gmail.com**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpol-cova%2Fminimal_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpol-cova%2Fminimal_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpol-cova%2Fminimal_api/lists"}