{"id":15573750,"url":"https://github.com/rakhmadi/volca","last_synced_at":"2025-03-29T07:10:10.160Z","repository":{"id":54788897,"uuid":"328661127","full_name":"Rakhmadi/Volca","owner":"Rakhmadi","description":" Deno framework","archived":false,"fork":false,"pushed_at":"2021-03-04T11:28:43.000Z","size":265,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T18:28:57.078Z","etag":null,"topics":["backend","deno","deno-framework","deno-typescript","framework","server","typescript","webserver"],"latest_commit_sha":null,"homepage":"","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/Rakhmadi.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-01-11T12:44:19.000Z","updated_at":"2021-03-31T21:09:33.000Z","dependencies_parsed_at":"2022-08-14T03:00:44.799Z","dependency_job_id":null,"html_url":"https://github.com/Rakhmadi/Volca","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rakhmadi%2FVolca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rakhmadi%2FVolca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rakhmadi%2FVolca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rakhmadi%2FVolca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rakhmadi","download_url":"https://codeload.github.com/Rakhmadi/Volca/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246150437,"owners_count":20731419,"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":["backend","deno","deno-framework","deno-typescript","framework","server","typescript","webserver"],"created_at":"2024-10-02T18:14:08.479Z","updated_at":"2025-03-29T07:10:10.082Z","avatar_url":"https://github.com/Rakhmadi.png","language":"TypeScript","readme":"# Volca Deno Web Framework\r\n\r\nSimple Deno Web Framework \r\n\r\n## Deno Version (1.7+)\r\n\r\n## Basic Usage\r\n\r\n```ts\r\nimport {AppServe,Request,Router} from \"https://deno.land/x/volca@v1.2.1/mod.ts\"\r\n\r\nAppServe(async()=\u003e{\r\n    Router.get('/',()=\u003e{\r\n        Request.toResponse({\r\n            content:'text/plain',\r\n            body:`Hello World`\r\n        })\r\n    })\r\n},{port:8080})\r\n```\r\n\r\n## Boilerplate\r\n\u003e\r\n\u003e https://github.com/Rakhmadi/volca-boilerplate\r\n\u003e\r\n\r\n## Routing\r\n\u003e\r\n\u003e **Router Setup**\r\n\u003e```ts\r\n\u003eimport {AppServe,Request,Router} from \"./mod.ts\"\r\n\u003e\r\n\u003eAppServe(async()=\u003e{\r\n\u003e   Router.get('/',()=\u003e{\r\n\u003e        Request.toResponse({\r\n\u003e            content:'text/plain',\r\n\u003e            body:`Hello World`\r\n\u003e        })\r\n\u003e    })\r\n\u003e},{port:8080})\r\n\u003e```\r\n\u003e\r\n\r\n\u003e **Available Router Methods**\r\n\u003e```ts\r\n\u003eRouter.get('/path',()=\u003e{});\r\n\u003eRouter.post('/path',()=\u003e{});\r\n\u003eRouter.put('/path',()=\u003e{});\r\n\u003eRouter.patch('/path',()=\u003e{});\r\n\u003eRouter.delete('/path',()=\u003e{});\r\n\u003eRouter.option('/path',()=\u003e{});\r\n\u003e```\r\n\r\n\u003e\r\n\u003e **Router parameter**\r\n\u003e ```ts \r\n\u003eRouter.get(`/Article/:slug/Category/:category`,()=\u003e{})\r\n\u003e```\r\n\u003e **Example Url**\r\n\u003e```ts\r\n\u003ehttp://localhost:8080/Article/How-to-make-web/Category/web-tech\r\n\u003e```\r\n\r\n\u003e**Adding middleware to the router**\r\n\u003e```ts\r\n\u003e Router.get('/path',()=\u003e{},[func1,func2...]);\r\n\u003e```\r\n\u003e\r\n\u003eExample\r\n\u003e```ts\r\n\u003efunction func1(next:any){\r\n\u003e   console.log(\"middleware 1\");\r\n\u003e   next()         \r\n\u003e}\r\n\u003e\r\n\u003e function func2(next:any){\r\n\u003e   console.log(\"middleware 2\");\r\n\u003e   next()         \r\n\u003e}\r\n\u003e\r\n\u003eRouter.get('/',()=\u003e{\r\n\u003e    Request.toResponse({\r\n\u003e        content:'text/plain',\r\n\u003e        body:`Hello World`\r\n\u003e    })\r\n\u003e},[func1,func2])\r\n\u003e```\r\n\u003e\r\n\r\n## Request Class\r\n\u003e\r\n\u003e \u003e## Properties\r\n\u003e \u003e | Name Property | Return  \r\n\u003e \u003e |--|--|\r\n\u003e \u003e | ``` path:string ``` | Get path of URL |\r\n\u003e \u003e | ``` method:string ``` | Get HTTP request method |\r\n\u003e \u003e | ``` params:object ``` | Get Router parameters |\r\n\u003e \u003e | ``` body:any ``` | Access Body Request |\r\n\u003e\r\n\u003e \u003e ## Methods\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003eaddResponseHeader(init?:HeadersInit)\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Add response headers\r\n\u003e \u003e \u003e\r\n\u003e \u003e \u003e Example :\r\n\u003e \u003e \u003e ```ts\r\n\u003e \u003e \u003eRequest.addResponseHeader({\r\n\u003e \u003e \u003e    \"Access-Control-Allow-Headers\" : \"*\",\r\n\u003e \u003e \u003e    \"Access-Control-Allow-Origin\" : \"*\"\r\n\u003e \u003e \u003e})\r\n\u003e \u003e \u003e ```\r\n\u003e \u003e \r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003egetHeader(name:string)\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Get header value\r\n\u003e \u003e \u003e \r\n\u003e \u003e \u003e Example :\r\n\u003e \u003e \u003e ```ts\r\n\u003e \u003e \u003eRequest.getHeader(\"User-Agent\")\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Return : \r\n\u003e \u003e \u003e ```\r\n\u003e \u003e \u003eMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36\r\n\u003e \u003e \u003e```\r\n\u003e \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003esetCookie(cokie:ICookie):void\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Add Cookie \r\n\u003e \u003e \u003e\r\n\u003e \u003e  \u003e Example :\r\n\u003e \u003e \u003e  ```ts\r\n\u003e \u003e \u003eRequest.setCookie({\r\n\u003e \u003e \u003e       name:\"x\",\r\n\u003e \u003e \u003e       value:\"xxx\"\r\n\u003e \u003e \u003e})\r\n\u003e \u003e \u003e```\r\n\u003e \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003egetCookie():object\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Get Cookies\r\n\u003e \u003e \u003e\r\n\u003e \u003e \u003e Return :\r\n\u003e \u003e \u003e ``` json\r\n\u003e \u003e \u003e {\r\n\u003e \u003e \u003e    \"x\": \"xxx\"\r\n\u003e \u003e \u003e }\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003edeleteCookie(name:string):void\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Delete Cookie\r\n\u003e \u003e \r\n\u003e \u003e \u003e ```ts\r\n\u003e \u003e \u003etoResponse(Respon:IRes={status:200,body:'',content:'text/plain'})\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003eSend HTTP Response \r\n\u003e \u003e \u003e\r\n\u003e \u003e \u003eExample :\r\n\u003e \u003e \u003e ```ts\r\n\u003e \u003e \u003ereturn  Request.toResponse({\r\n\u003e \u003e \u003e   status:'200', // Default 200\r\n\u003e \u003e \u003e   headers:{\r\n\u003e \u003e \u003e      \"Access-Control-Allow-Headers\"  :  \"*\",\r\n\u003e \u003e \u003e      \"Access-Control-Allow-Origin\"  :  \"*\"\r\n\u003e \u003e \u003e   },\r\n\u003e  \u003e \u003e   content:'text/plain', // see in https://www.iana.org/assignments/media-types/media-types.xhtml\r\n\u003e \u003e \u003e   body:'Hello World',\r\n\u003e \u003e \u003e   \r\n\u003e \u003e \u003e})\r\n\u003e \u003e\u003e ```\r\n\u003e \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003etoView(file:string,data:object):Promise\u003cany\u003e\r\n\u003e \u003e \u003e```\r\n\u003e  \u003e \u003e Loading a view to response using the Eta engine\r\n\u003e  \u003e \u003e  \r\n\u003e  \u003e \u003e Example :\r\n\u003e  \u003e \u003e ```ts\r\n\u003e  \u003e \u003e Request.toView('public/index.html',{ favoriteCake: 'Chocolate!' })\r\n\u003e  \u003e \u003e ```\r\n\u003e  \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003etoRedirect(status:number, toLocation:string)\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Redirect page \r\n\u003e \u003e  \u003e \r\n\u003e  \u003e \u003e Example :\r\n\u003e \u003e  \u003e ```ts\r\n\u003e \u003e \u003e Request.toRedirect(301,'/x') // Redirect status codes 301 to path location /x\r\n\u003e \u003e \u003e```\r\n\u003e \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003etoResponseJson(Json:Array\u003cany\u003e | any ,status:number,headers:HeadersInit = {})\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Method will automatically set the `Content-Type` header to `application/json`\r\n\u003e \u003e \u003e \r\n\u003e \u003e \u003e Example :\r\n\u003e \u003e \u003e ```ts\r\n\u003e \u003e \u003e Request.toResponseJson({ favoriteCake: 'Chocolate!'  },200)\r\n\u003e \u003e \u003e ```\r\n\u003e \u003e \u003e\r\n\u003e \u003e \u003e\r\n\u003e \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003e  getQuery():object\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Get search query url\r\n\u003e \u003e \u003e\r\n\u003e \u003e \u003e Example Url : http://localhost:8080/query?name=Branch\u0026products=[Journeys,Email,Universal%20Ads]\r\n\u003e \u003e \u003e \r\n\u003e \u003e \u003e return :\r\n\u003e \u003e \u003e ``` \r\n\u003e \u003e \u003e    {\r\n\u003e \u003e \u003e       \"name\": \"Branch\",\r\n\u003e \u003e \u003e       \"products\": \"[Journeys,Email,Universal Ads]\"\r\n\u003e \u003e \u003e    }\r\n\u003e \u003e \u003e    ```\r\n\u003e \u003e\r\n\u003e \u003e \u003e```ts\r\n\u003e \u003e \u003e  async formField():Promise\u003cobject\u003e\r\n\u003e \u003e \u003e```\r\n\u003e \u003e \u003e Get form Field 'application/x-www-form-urlencoded'\r\n\r\n\r\nlist of dependencies used\r\n* https://github.com/deligenius/multiparser - multipart/form-data parser for Deno servers\r\n* https://github.com/eta-dev/eta - Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript\r\n* https://github.com/eveningkid/denodb - MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno\r\n\r\n## License\r\nMIT License\r\n\r\nCopyright (c) 2021 Rakhmadi\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakhmadi%2Fvolca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakhmadi%2Fvolca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakhmadi%2Fvolca/lists"}