{"id":17689972,"url":"https://github.com/mikigal/webserver","last_synced_at":"2025-03-30T22:13:54.587Z","repository":{"id":102381442,"uuid":"200372274","full_name":"mikigal/webserver","owner":"mikigal","description":"Lightweight own HTTP implementation with MVC in Go","archived":false,"fork":false,"pushed_at":"2019-08-04T23:11:00.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T02:44:36.323Z","etag":null,"topics":["go","golang","http-protocol","lightweight-mvc-framework","mvc","webserver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikigal.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-08-03T12:19:54.000Z","updated_at":"2022-06-25T03:33:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e76bdfb-9f2f-4d5e-90b7-7dcf38657685","html_url":"https://github.com/mikigal/webserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2Fwebserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2Fwebserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2Fwebserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikigal%2Fwebserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikigal","download_url":"https://codeload.github.com/mikigal/webserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246385415,"owners_count":20768672,"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","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":["go","golang","http-protocol","lightweight-mvc-framework","mvc","webserver"],"created_at":"2024-10-24T11:49:30.452Z","updated_at":"2025-03-30T22:13:54.561Z","avatar_url":"https://github.com/mikigal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webserver\nLightweight own (without net/http) HTTP protocol implementation with basic MVC in Go\n\n## How to use?\n#### Example with Context usage: [\\*Click\\*](main.go)\n```go\nfunc main() {\n    server := webserver.WebServer {\n        Address: \"localhost:1234\", // Address for server\n        WebsiteDir: \"./example_website\", // Working directory with website files\n    }\n\n    // If there isn't route for URL server serve file from WebsiteDir, for / it's index.html\n    server.Route(test, \"/test\", \"GET\", \"POST\") // Route \"/test\" to function \"root\" for HTTP methods GET and POST\n    server.ErrorHandler(404, customError) // Redirect all 404 errors to customError function\n    server.Start() // Start server!\n}\n\nfunc test(ctx *webserver.Context) {\n    // Do something awesome\n\n    //ctx.Redirect(http.StatusMovedPermanently, \"/anotherPath\")\n    //ctx.HTML(200, \"\u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003ch1\u003eTest\u003c/h1\u003e\u003c/body\u003e\u003c/html\u003e\")\n    //ctx.JSON(200, \"{\\\"test\\\": \\\"abc\\\"}\")\n    //ctx.Error(403, \"\")\n    ctx.File(200, \"test.html\")\n}\n\nfunc customError(ctx *webserver.Context) {\n    ctx.JSON(404, \"{\\\"error\\\": \\\"not_found\\\"}\")\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikigal%2Fwebserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikigal%2Fwebserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikigal%2Fwebserver/lists"}