{"id":15284303,"url":"https://github.com/theatom06/jiffyts","last_synced_at":"2025-04-12T23:21:44.498Z","repository":{"id":224499750,"uuid":"763141532","full_name":"theatom06/jiffyts","owner":"theatom06","description":"A simple and fast server framework for bun.js","archived":false,"fork":false,"pushed_at":"2024-02-26T10:26:53.000Z","size":6,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-26T20:47:38.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/theatom06.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":"2024-02-25T17:05:27.000Z","updated_at":"2024-03-08T08:55:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"710c053b-fe1a-4eeb-aae2-81a884e93015","html_url":"https://github.com/theatom06/jiffyts","commit_stats":null,"previous_names":["theatom06/jiffyts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theatom06%2Fjiffyts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theatom06%2Fjiffyts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theatom06%2Fjiffyts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theatom06%2Fjiffyts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theatom06","download_url":"https://codeload.github.com/theatom06/jiffyts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248644181,"owners_count":21138564,"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-09-30T14:53:13.071Z","updated_at":"2025-04-12T23:21:44.474Z","avatar_url":"https://github.com/theatom06.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jiffy: A Lightweight Bun-Based Server Framework\n\nThis repository contains a minimal server framework built on top of Bun for creating efficient and scalable web applications. It provides a structured approach for handling HTTP requests and response capabilities.\n\n## Quick Start:\n\n1. **Install Bun:**\n   ```bash\n   bun i jiffyts -g\n   ```\n2. **Create an instance of the `Jiffy` class:**\n   ```javascript\n   import Jiffy from './app';\n\n   const app = new Jiffy({}); //the {} is important for configs which will be added later\n   ```\n3. **Define routes and handlers:**\n   ```javascript\n   app.get('/api', (req) =\u003e {\n     return 'Hello, world!';\n   }, 'text/plain');\n\n    app.get('/index', (req) =\u003e {\n     return Bun.file('/index.html');\n    }, 'text/html');\n   ```\n5. **Start the server:**\n   ```javascript\n   app.listen(3000);\n   ```\n\n## API\n\n### `app.get(path: string, handler: RouteHandler, contentType: string = \"text/plain\")`\n\n- **Description:** Add a route for handling GET requests.\n- **Parameters:**\n  - `path`: The URL path for the route.\n  - `handler`: The route handler function.\n  - `contentType`: (Optional) The content type of the response. Default is `text/plain`.\n\n### `app.post(path: string, handler: RouteHandler, contentType: string = \"text/plain\")`\n\n- **Description:** Add a route for handling POST requests.\n- **Parameters:**\n  - `path`: The URL path for the route.\n  - `handler`: The route handler function.\n  - `contentType`: (Optional) The content type of the response. Default is `text/plain`.\n\n### `app.put(path: string, handler: RouteHandler, contentType: string = \"text/plain\")`\n\n- **Description:** Add a route for handling PUT requests.\n- **Parameters:**\n  - `path`: The URL path for the route.\n  - `handler`: The route handler function.\n  - `contentType`: (Optional) The content type of the response. Default is `text/plain`.\n\n### `app.delete(path: string, handler: RouteHandler, contentType: string = \"text/plain\")`\n\n- **Description:** Add a route for handling DELETE requests.\n- **Parameters:**\n  - `path`: The URL path for the route.\n  - `handler`: The route handler function.\n  - `contentType`: (Optional) The content type of the response. Default is `text/plain`.\n\n### `app.notFound(res: string | BunFile = \"Default 404\")`\n\n- **Description:** Set a custom response for 404 Not Found errors.\n- **Parameter:**\n  - `res`: (Optional) Custom response for 404 errors. Default is \"Default 404\".\n\n### `RouteHandler`\n\n- **Type:** `(req: Request) =\u003e string | BunFile`\n- **Description:** A function that takes an HTTP request (`Request` object) and returns either a string or a `BunFile`. Use this to define the logic for handling different routes.\n\n## Contributing:\n\nContributions are welcome! Please refer to the [Gandalf's JavaScript Naming Scheme](https://gist.github.com/theatom06/62b4a5d90346422f443b93869cd2436d) file for formating.\n\n## License:\n\nThis project is licensed under the [Carbon License v2.2.0](https://gist.github.com/theatom06/6d520406e0d1d7612f29d31517888d90). See the LICENSE file for details.\n\n## Contact:\n\nFor any queries or feedback, please reach out to steve.alappat@gmail.com.\n\n## Future Plans:\n\n- Adding WebSockets support\n- Adding middleware\n- Usage in Meta Framework\n\nGemini was used to create doucmentation, format the code and help in debuging.\n\nVScode was used as a editor for this project.\n\nThis project was created using `bun init` in bun v1.0.25. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheatom06%2Fjiffyts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheatom06%2Fjiffyts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheatom06%2Fjiffyts/lists"}