{"id":16246303,"url":"https://github.com/dingpingzhang/naivehttpserver","last_synced_at":"2025-03-19T19:30:39.838Z","repository":{"id":65441034,"uuid":"400735561","full_name":"DingpingZhang/NaiveHttpServer","owner":"DingpingZhang","description":"A simple C# http server based on the HttpListener.","archived":false,"fork":false,"pushed_at":"2022-10-26T08:46:51.000Z","size":53,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T17:18:36.613Z","etag":null,"topics":["file-server","http","http-server","simple-http-server"],"latest_commit_sha":null,"homepage":"","language":"C#","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/DingpingZhang.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}},"created_at":"2021-08-28T07:54:40.000Z","updated_at":"2025-01-03T09:24:17.000Z","dependencies_parsed_at":"2023-01-23T18:25:12.937Z","dependency_job_id":null,"html_url":"https://github.com/DingpingZhang/NaiveHttpServer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DingpingZhang%2FNaiveHttpServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DingpingZhang%2FNaiveHttpServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DingpingZhang%2FNaiveHttpServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DingpingZhang%2FNaiveHttpServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DingpingZhang","download_url":"https://codeload.github.com/DingpingZhang/NaiveHttpServer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244492712,"owners_count":20461554,"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":["file-server","http","http-server","simple-http-server"],"created_at":"2024-10-10T14:30:16.649Z","updated_at":"2025-03-19T19:30:39.551Z","avatar_url":"https://github.com/DingpingZhang.png","language":"C#","readme":"# NaiveHttpServer [![version](https://img.shields.io/nuget/v/NaiveHttpServer.svg)](https://www.nuget.org/packages/NaiveHttpServer)\n\nA simple C# http server based on the HttpListener.\n\n## How to Use\n\n```csharp\n// Build Routers\nvar router = new RouterBuilder()\n    .Get(\"/user/:id\", async ctx =\u003e\n    {\n        // Gets parameters from URL or QUERY string by name.\n        if (ctx.TryGetParameter(\"id\", out string id))\n        {\n            // TODO: using the id parameter.\n            await ctx.Response.Json(new\n            {\n                id,\n                // TODO: other properties.\n            });\n        }\n    })\n    .Post(\"/user\", async ctx =\u003e\n    {\n        dynamic body = ctx.Request.JsonFromBody\u003cUser\u003e();\n        // TODO: using the body object.\n    })\n    .Put(\"/user/:id\", async ctx =\u003e { /* TODO: Do something. */ })\n    .Delete(\"/user/:id\", async ctx =\u003e { /* TODO: Do something. */ })\n    .Build();\n\n// Create server instance\nvar server = new Server(\"localhost\", 2333);\n\n// Configure server\nserver\n    .Use(Middlewares.Log)\n    .Use(Middlewares.Execute)\n    .Use(router)\n    .Use(Middlewares.StaticFile(\"/files\", Environment.CurrentDirectory))\n    .Use(Middlewares.NotFound(documentUrl: \"http://api.project.com/v1\"));\n\n// Launch server\nserver.Start();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdingpingzhang%2Fnaivehttpserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdingpingzhang%2Fnaivehttpserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdingpingzhang%2Fnaivehttpserver/lists"}