{"id":16157884,"url":"https://github.com/mrxiaozhuox/denly","last_synced_at":"2025-03-18T20:30:56.636Z","repository":{"id":62422030,"uuid":"356289238","full_name":"mrxiaozhuox/denly","owner":"mrxiaozhuox","description":"A Deno web development framework","archived":false,"fork":false,"pushed_at":"2021-12-25T04:49:27.000Z","size":211,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T22:12:36.837Z","etag":null,"topics":["deno","framework","web"],"latest_commit_sha":null,"homepage":"https://denly.mrxzx.info/","language":"TypeScript","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/mrxiaozhuox.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-04-09T13:56:40.000Z","updated_at":"2022-08-20T08:56:43.000Z","dependencies_parsed_at":"2022-11-01T17:33:02.699Z","dependency_job_id":null,"html_url":"https://github.com/mrxiaozhuox/denly","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxiaozhuox%2Fdenly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxiaozhuox%2Fdenly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxiaozhuox%2Fdenly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxiaozhuox%2Fdenly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrxiaozhuox","download_url":"https://codeload.github.com/mrxiaozhuox/denly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950792,"owners_count":20373664,"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":["deno","framework","web"],"created_at":"2024-10-10T01:51:02.856Z","updated_at":"2025-03-18T20:30:56.383Z","avatar_url":"https://github.com/mrxiaozhuox.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cbr /\u003e\n    \u003cimg src=\"./docs/icon.svg\"\u003e\n    \u003ch3 align=\"center\"\u003e🦕 Denly Web Framework 🦕\u003c/h3\u003e\n    \u003cp align=\"center\"\u003e\n        \u003ca href=\"https://github.com/mrxiaozhuox/Denly/releases/latest/\"\u003e\n            \u003cimg alt=\"Release\" src=\"https://img.shields.io/github/v/release/mrxiaozhuox/Denly\" /\u003e\n        \u003c/a\u003e\n    \t\u003ca href=\"https://github.com/mrxiaozhuox/Denly\"\u003e\n    \t\t\u003cimg alt=\"Denly Stars\" src=\"https://img.shields.io/github/stars/mrxiaozhuox/Denly\" /\u003e\n    \t\u003c/a\u003e\n        \u003ca href=\"https://github.com/mrxiaozhuox/Denly/blob/master/LICENSE\"\u003e\n        \t\u003cimg alt=\"MIT License\" src=\"https://img.shields.io/badge/license-MIT-green\" /\u003e\n        \u003c/a\u003e\n\t\u003c/p\u003e\n\t\u003cp align=\"center\"\u003e\u003ca href=\"https://denly.mrxzx.info\"\u003eHome\u003c/a\u003e | \u003ca href=\"#\"\u003eDocumentation\u003c/a\u003e\u003c/p\u003e\n\u003c/p\u003e\n\n## Functions\n\n- Router System\n- Get Args \u0026 Form Data\n- Response System (redirect,abort)\n- Memory System (useful cache)\n- Session (realized in memory sys)\n- Event (trigger and timer)\n- Hot-Loading (automatic restart after editing the file)\n\n## Try it\n\nYou just need import the file from github (or gitee)\n\n```typescript\nimport { Denly } from \"https://deno.land/x/denly@V0.25/mod.ts\";\n\nlet app = new Denly({\n  hostname: \"127.0.0.1\",\n  port: 808,\n  options: {\n    debug: true,\n  },\n});\n\napp.route.get(\"/\", () =\u003e {\n  return \"Hello Denly!\";\n});\n\napp.run();\n```\n\nIt's easy to use, you don't need to download other file, just import the package\nfrom online.\n\n### Hot-loading [_unstable_]\n\nif you want the server automatic restart after the file edited, then you can use\n**hot-loading**.\n\n```shell\ndeno run --allow-run https://deno.land/x/denly@V0.25/debug.ts ./mod.ts\n```\n\n### URL parameters\n\nYou can define a URL parameter based on a regular expression.\n\n```typescript\napp.route.regex(\"letter\", /^[a-zA-Z]+$/g);\napp.route.get(\"/user/:letter\", (name: string) =\u003e {\n  return `Hello ${name}`;\n});\n```\n\nThe framework is equipped with the following regular expressions by default:\n\n- letter [ a-z A-Z ]\n- number [ 0-9 ]\n- email [ valid email ]\n- phone [ phone number (for Chinese) ]\n- date [ valid date ]\n\n### Custom status code\n\n**response.status** can change status code !\n\n```typescript\napp.response.status = 500;\n\nreturn app.response.json({\n  \"code\": 500,\n  \"data\": [],\n  \"message\": \"Server Error\",\n});\n```\n\n### Error fallback\n\nYou can send different error status codes and customize how you handle them.\n\n```typescript\napp.route.fallback(404, () =\u003e {\n  return {\n    header: new Headers(), // A headers object\n    body: new TextEncoder().encode(\"\u003ch1\u003e404 Not Found\u003c/h1\u003e\"),\n  };\n});\n\n// trigger it\napp.route.get(\"/error/404\", () =\u003e {\n  return app.response.abort(404);\n});\n```\n\n### Output file\n\nYou can simply return a file.\n\n```typescript\napp.route.get(\"/image\", () =\u003e {\n  // Auto-updates headers based on the suffix.\n  return app.response.file(\"./background.jpg\");\n});\n```\n\nThe file function have second parameter can set **Content-Type**.\n\n### Static route\n\n```typescript\napp.route.resource(\"/static\", \"./public\");\n```\n\nYou can bind a static routes by passing the path to the local folder and the\npublic alias to the **resource** function.\n\n### File upload\n\n```typescript\nconst file = app.request.file(\"file\");\nDeno.writeFileSync(\n  _tempdir + \"/runtime/upload/\" + file.name,\n  new Uint8Array(await file.arrayBuffer()),\n);\n```\n\nYou can use **Request.file** to upload file.\n\n## Template\n\nWe provide a template code for large projects!\n\n[Denly-Template](https://github.com/DenlyJS/Denly-Template)\n\nor you can use denly-cli to init it!\n\n```shell\ndeno install https://deno.land/x/denly@V0.25/cli.ts -A -n denly\n```\n\ncreate a new project:\n\n```shell\ndenly init\n```\n\n## Developer\n\nAuthor: ZhuoEr Liu \u003cmrxzx@qq.com\u003e\n\nI am a back-end engineer and have recently been learning how to use Deno.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxiaozhuox%2Fdenly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrxiaozhuox%2Fdenly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxiaozhuox%2Fdenly/lists"}