{"id":21045365,"url":"https://github.com/ymzuiku/nature-http","last_synced_at":"2025-03-13T22:12:44.674Z","repository":{"id":57308977,"uuid":"146618965","full_name":"ymzuiku/nature-http","owner":"ymzuiku","description":" 一个非常自然的 web 框架  没有任何黑魔法，源码仅有 250 行，纯粹的 nodejs 原生 http 库","archived":false,"fork":false,"pushed_at":"2018-11-13T17:06:22.000Z","size":227,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T20:37:43.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ymzuiku.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}},"created_at":"2018-08-29T15:15:27.000Z","updated_at":"2018-11-13T17:06:24.000Z","dependencies_parsed_at":"2022-09-14T18:10:37.046Z","dependency_job_id":null,"html_url":"https://github.com/ymzuiku/nature-http","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/ymzuiku%2Fnature-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymzuiku%2Fnature-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymzuiku%2Fnature-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymzuiku%2Fnature-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ymzuiku","download_url":"https://codeload.github.com/ymzuiku/nature-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489835,"owners_count":20299001,"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":[],"created_at":"2024-11-19T14:21:49.723Z","updated_at":"2025-03-13T22:12:44.640Z","avatar_url":"https://github.com/ymzuiku.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nature\n\n一个非常自然的 web 框架\n\n没有任何黑魔法，源码仅有 250 行，纯粹的 nodejs 原生 http 库，为了性能没有使用 async。\n\n## 使用例子\n\n```js\nconst nature = require('nature-http');\nconst staticPath = nature.resolve(process.cwd(), './example/public/');\n\n// nature.pages['404'] = '/api/test?bbb=222';\n\nconst schema = `\n  type Query {\n      hello: String\n  }\n`;\n\nnature.listenThreads(4100, ctx =\u003e {\n  ctx.get('/api/get', data =\u003e {\n    ctx.res.end(JSON.stringify(data));\n  });\n  ctx.post('/api/post', data =\u003e {\n    console.log(data);\n    ctx.res.end(JSON.stringify(data));\n  });\n  ctx.graph('/graphql', schema, {\n    hello: () =\u003e 'hello, graphql',\n  });\n  ctx.static(nature.resolve(staticPath));\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymzuiku%2Fnature-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymzuiku%2Fnature-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymzuiku%2Fnature-http/lists"}