{"id":24499135,"url":"https://github.com/johndavedecano/lizard","last_synced_at":"2025-04-14T05:32:41.249Z","repository":{"id":273458316,"uuid":"919785707","full_name":"johndavedecano/lizard","owner":"johndavedecano","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-26T06:45:14.000Z","size":55,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T19:15:15.732Z","etag":null,"topics":["api","bun","javascript","oop","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/johndavedecano.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":"2025-01-21T02:25:26.000Z","updated_at":"2025-01-26T06:45:17.000Z","dependencies_parsed_at":"2025-01-21T03:34:23.009Z","dependency_job_id":null,"html_url":"https://github.com/johndavedecano/lizard","commit_stats":null,"previous_names":["johndavedecano/lizard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndavedecano%2Flizard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndavedecano%2Flizard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndavedecano%2Flizard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndavedecano%2Flizard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johndavedecano","download_url":"https://codeload.github.com/johndavedecano/lizard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248826712,"owners_count":21167731,"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":["api","bun","javascript","oop","typescript"],"created_at":"2025-01-21T22:13:15.386Z","updated_at":"2025-04-14T05:32:41.242Z","avatar_url":"https://github.com/johndavedecano.png","language":"TypeScript","readme":"# Lizard\n\nLizard is a lightweight wrapper on top of [Bun](https://bun.sh), a fast all-in-one JavaScript runtime. This project provides a simple and efficient way to create web applications with minimal setup.\n\n## Features\n\n- **Fast and Lightweight**: Built on Bun, ensuring high performance.\n- **Simple Routing**: Define routes easily with support for dynamic parameters.\n- **Middleware Support**: Add middleware functions to handle requests.\n- **TypeScript Support**: Written in TypeScript for type safety and better development experience.\n\n## Installation\n\nTo install dependencies, run:\n\n```bash\nbun install\n```\n\n## Running the Application\n\nTo start the application, run:\n\n```bash\nbun run index.ts\n```\n\nThe server will start on port 3000 by default.\n\n## Project Structure\n\n```plaintext\n├── .gitignore\n├── bun.lockb\n├── index.ts\n├── lizard.ts\n├── package.json\n├── README.md\n├── tsconfig.json\n├── types.ts\n├── utils.test.ts\n└── utils.ts\n```\n\n- **index.ts**: Entry point of the application.\n- **lizard.ts**: Core framework implementation.\n- **types.ts**: Type definitions for the framework.\n- **utils.ts**: Utility functions used by the framework.\n- **utils.test.ts**: Unit tests for utility functions.\n\n## Example Usage\n\nHere is an example of how to define routes in your application:\n\n```ts\nimport Lizard from \"./lizard\";\nimport type { Middleware } from \"./types\";\n\nconst app = Lizard.create();\n\n// Global middleware to log requests\nconst loggerMiddleware: Middleware = async (event, next) =\u003e {\n\tconsole.log(`Request: ${event.method} ${event.url}`);\n\treturn next();\n};\n\n// Global middleware to add a custom header\nconst headerMiddleware: Middleware = async (event, next) =\u003e {\n\tevent.response.headers.set('X-Custom-Header', 'Lizard');\n\treturn next();\n};\n\n// Apply global middlewares\napp.use(loggerMiddleware);\napp.use(headerMiddleware);\n\napp.get('/', async (event) =\u003e {\n\treturn event.response.send(\"Hello, World!\");\n});\n\napp.get('/home', async (event) =\u003e {\n\treturn event.response.send(\"Home Page\");\n});\n\napp.get('/home/:id', async (event) =\u003e {\n\treturn event.response.send(\"Home Page\" + event.params?.id);\n});\n\napp.get('/home/:id', async (event) =\u003e {\n\treturn event.response.send(`User ${event.params?.id}`);\n});\n\napp.get('/home/:id', async (event) =\u003e {\n\treturn event.response.send(`User ${event.params?.id}`);\n});\n\napp.get('/home/:id/profile', async (event) =\u003e {\n\treturn event.response.send(`User ${event.params?.id} Profile`);\n});\n\napp.post('/user', async (event) =\u003e {\n\treturn event.response.send(\"User Created\");\n});\n\napp.put('/user/:id', async (event) =\u003e {\n\treturn event.response.send(`User ${event.params?.id} Updated`);\n});\n\napp.del('/user/:id', async (event) =\u003e {\n\treturn event.response.send(`User ${event.params?.id} Deleted`);\n});\n\n\napp.listen(3000);\n```\n\nIn this example, the middleware sets a `user` object in the `event.locals` property. The `/profile` route then accesses this local variable and returns the user's name in the response.\n\n## License\n\nThis project is licensed under the MIT License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohndavedecano%2Flizard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohndavedecano%2Flizard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohndavedecano%2Flizard/lists"}