burger-api 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Isfhan Ahmed
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Isfhan Ahmed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,166 +1,275 @@
1
- <p align="center">
2
- <img src="https://github.com/user-attachments/assets/0d9b376e-1d89-479a-aa7f-e7ee3c6b2342" alt="BurgerAPI logo"/>
3
- </p>
4
-
5
- [![Under Development](https://img.shields.io/badge/under%20development-red.svg)](https://github.com/isfhan/burger-api)
6
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./packages/burger-api/LICENSE)
7
- [![Bun](https://img.shields.io/badge/Bun-1.2.20-black?logo=bun)](https://bun.sh)
8
- [![Version](https://img.shields.io/badge/version-0.6.2-green.svg)](https://github.com/isfhan/burger-api/releases)
9
-
10
- **burger-api** is a modern, open source API framework built on
11
- [Bun.js](https://bun.sh). It combines the simplicity of file-based routing with
12
- powerful features like built-in middleware, Zod-based schema validation, and
13
- automatic OpenAPI generation. Designed for high performance and ease-of-use,
14
- burger-api leverages Bun's native modules to deliver blazing-fast API responses
15
- while keeping your codebase clean and maintainable.
16
-
17
- **This project is under active development and should not be used in production
18
- yet.**
19
-
20
- ## 📚 Table of Contents
21
-
22
- - [Overview](#-overview)
23
- - [Changelog](#-changelog)
24
- - [What's Coming Next](#-whats-coming-next)
25
- - [Contributing](#-contributing)
26
- - [License](#-license)
27
-
28
- ## 📖 Documentation
29
-
30
- For detailed documentation and examples, visit the
31
- [BurgerAPI official docs](https://burger-api.com/).
32
-
33
- ## 🚀 Overview
34
-
35
- burger-api is built to offer a robust developer experience through:
36
-
37
- - ⚡ **Bun-Native Performance:**
38
- Leverages Bun's high-performance HTTP server.
39
-
40
- - 📁 **File-Based Routing:**
41
- Automatically registers API routes from your file structure using a clear
42
- naming convention.
43
-
44
- - 🔄 **Middleware Architecture:**
45
- Supports both global and route-specific middleware. Simple, powerful
46
- middleware system with three return types:
47
-
48
- - `Response` - Stop here, send this response
49
- - `Function` - Transform the final response after handler runs
50
- - `undefined` - Continue to next middleware
51
-
52
- - ✅ **Type-Safe Validation:**
53
- Utilizes Zod for request validation, ensuring full type safety and automatic
54
- error reporting.
55
-
56
- - 📚 **Automatic OpenAPI Generation:**
57
- Generates a complete OpenAPI 3.0 specification directly from your routes and
58
- Zod schemas.
59
-
60
- - 🔍 **Swagger UI Integration:**
61
- Out-of-the-box Swagger UI endpoint for interactive API documentation.
62
-
63
- ## 📣 Changelog
64
-
65
- ### Latest Version: 0.6.2 (November 13, 2025)
66
-
67
- - ⚡ **Major Performance Improvements:**
68
-
69
- - middleware execution with specialized fast paths
70
- - AOT compilation with pre-computed middleware arrays
71
- - Zero runtime allocations (pre-allocated arrays)
72
- - Manual loop unrolling for 2-middleware case
73
- - Reduced code from ~110 to ~80 lines
74
-
75
- - 🎯 **Simplified Middleware System:**
76
-
77
- - Clearer return types: Response, Function, or undefined
78
- - Removed complex "around" middleware pattern
79
- - Dedicated fast paths for 0, 1, and 2 middlewares
80
- - Better JIT optimization
81
-
82
- - 📦 **Monorepo Structure:**
83
-
84
- - Converted to Bun workspace monorepo
85
- - Core framework in `packages/burger-api`
86
- - CLI tool in `packages/cli` (under development)
87
- - Ecosystem middleware at root level
88
-
89
- - 🔧 **Developer Experience:**
90
- - 100% backward compatible
91
- - Clearer documentation
92
- - Easier to understand codebase
93
-
94
- ### Previous Version: 0.5.2 (November 9, 2025)
95
-
96
- - 🔧 **Internal Improvements:**
97
- - Refactored wildcard parameter extraction logic into reusable utility
98
- functions
99
- - Added test suites and README files for all example projects
100
-
101
- ### Previous Version: 0.5.0 (November 1, 2025)
102
-
103
- - 🌟 **Feature:** Auto-injected OPTIONS handler for CORS preflight:
104
-
105
- - Automatically injects an OPTIONS handler for CORS preflight when needed
106
- - Only injects if the route defines any preflight-triggering methods and
107
- lacks an OPTIONS handler
108
- - Injects a minimal OPTIONS handler that returns a 204 No Content response
109
- - Works for all HTTP methods that trigger CORS preflight (POST, PUT,
110
- DELETE, PATCH)
111
- - Does not inject if the route already has an OPTIONS handler
112
-
113
- - 🌟 **Feature:** Improved response handling in middleware (after
114
- middlewares):
115
-
116
- - After middlewares now run even if the current middleware already
117
- returned a response
118
- - After middlewares run in reverse order to make changing the response
119
- easier and to help with CORS
120
-
121
- - 🐛 **Bug Fix:** Fixed TypeScript type resolution for package consumers:
122
- - Users now get full IntelliSense, autocomplete, and type safety out of
123
- the box
124
-
125
- ### Previous Version: 0.4.0 (October 21, 2025)
126
-
127
- - 🌟 **Feature:** Wildcard Routes:
128
- - Added wildcard routes using `[...]` folder name - matches any path after
129
- it
130
- - Create routes that handle multiple path segments automatically
131
- - Access all matched path parts through `wildcardParams` in your request
132
- - Routes are matched in order: exact paths first, then dynamic routes
133
- (like `[id]`), then wildcards last
134
- - Works inside dynamic routes too (example: `/api/users/[userId]/[...]`)
135
- - View wildcard routes in OpenAPI docs and Swagger UI
136
-
137
- ### Previous Version: 0.3.0 (August 15, 2025)
138
-
139
- - 🌟 **Feature:** Updated Zod to version 4:
140
- - Updated Zod version from 3.x to 4.x
141
- - Updated built-in request validation middleware to use Zod 4
142
- - Updated and better request validation middleware error handling
143
- - Removed Zod-to-json-schema dependency and use Zod 4 directly
144
-
145
- For a complete list of changes, please check the [Changelog](./packages/burger-api/CHANGELOG.md) file.
146
-
147
- ## 🎯 What's Coming Next?
148
-
149
- We're actively enhancing burger-api with powerful new features Stay tuned for
150
- updates as we continue to build and improve burger-api! We're committed to
151
- making it the best API framework for Bun.js.
152
-
153
- ## 🤝 Contributing
154
-
155
- We welcome contributions from the community! If you have suggestions or
156
- improvements, please open an issue or submit a pull request. Let's build
157
- something amazing together.
158
-
159
- ## 📄 License
160
-
161
- This project is licensed under the MIT License - see the [LICENSE](./packages/burger-api/LICENSE) file
162
- for details.
163
-
164
- The MIT License is a permissive license that is short and to the point. It lets
165
- people do anything they want with your code as long as they provide attribution
166
- back to you and don't hold you liable.
1
+ <div align="center">
2
+ <a href="https://burger-api.com">
3
+ <img src="https://github.com/user-attachments/assets/0d9b376e-1d89-479a-aa7f-e7ee3c6b2342" alt="BurgerAPI"/>
4
+ </a>
5
+ </div>
6
+
7
+ [![Under Development](https://img.shields.io/badge/under%20development-red.svg)](https://github.com/isfhan/burger-api)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./packages/burger-api/LICENSE)
9
+ [![Bun](https://img.shields.io/badge/Bun-1.2.20-black?logo=bun)](https://bun.sh)
10
+ [![Version](https://img.shields.io/badge/version-0.6.2-green.svg)](https://github.com/isfhan/burger-api/releases)
11
+
12
+ **burger-api** is a modern, open source API framework built on
13
+ [Bun.js](https://bun.sh). It combines the simplicity of file-based routing with
14
+ powerful features like built-in middleware, Zod-based schema validation, and
15
+ automatic OpenAPI generation. Designed for high performance and ease-of-use,
16
+ burger-api leverages Bun's native modules to deliver blazing-fast API responses
17
+ while keeping your codebase clean and maintainable.
18
+
19
+ **This project is under active development and should not be used in production
20
+ yet.**
21
+
22
+ ## 📚 Table of Contents
23
+
24
+ - [Overview](#-overview)
25
+ - [CLI Tool](#-cli-tool)
26
+ - [Changelog](#-changelog)
27
+ - [What's Coming Next](#-whats-coming-next)
28
+ - [Contributing](#-contributing)
29
+ - [License](#-license)
30
+
31
+ ## 📖 Documentation
32
+
33
+ For detailed documentation and examples, visit the
34
+ [BurgerAPI official docs](https://burger-api.com/).
35
+
36
+ ## 🚀 Overview
37
+
38
+ burger-api is built to offer a robust developer experience through:
39
+
40
+ - ⚡ **Bun-Native Performance:**
41
+ Leverages Bun's high-performance HTTP server.
42
+
43
+ - 📁 **File-Based Routing:**
44
+ Automatically registers API routes from your file structure using a clear
45
+ naming convention.
46
+
47
+ - 🔄 **Middleware Architecture:**
48
+ Supports both global and route-specific middleware. Simple, powerful
49
+ middleware system with three return types:
50
+
51
+ - `Response` - Stop here, send this response
52
+ - `Function` - Transform the final response after handler runs
53
+ - `undefined` - Continue to next middleware
54
+
55
+ - ✅ **Type-Safe Validation:**
56
+ Utilizes Zod for request validation, ensuring full type safety and automatic
57
+ error reporting.
58
+
59
+ - 📚 **Automatic OpenAPI Generation:**
60
+ Generates a complete OpenAPI 3.0 specification directly from your routes and
61
+ Zod schemas.
62
+
63
+ - 🔍 **Swagger UI Integration:**
64
+ Out-of-the-box Swagger UI endpoint for interactive API documentation.
65
+
66
+ ## 🛠️ CLI Tool (Newly Added)
67
+
68
+ burger-api comes with a powerful CLI tool that makes it easy to scaffold new
69
+ projects and manage middleware. Install it globally to get started:
70
+
71
+ ### Installation
72
+
73
+ **Option 1: Bun Global Installation (Recommended if you have Bun installed)**
74
+
75
+ ````bash
76
+ # Global installation
77
+ bun add -g @burger-api/cli
78
+ ````
79
+ **Or use with bunx (No Installation Needed):**
80
+
81
+ ````bash
82
+ bunx @burger-api/cli create my-project
83
+ ````
84
+
85
+ **Option 2: Standalone Executable (Alternative Installation Method)**
86
+
87
+ **macOS, Linux, WSL:**
88
+
89
+ ```bash
90
+ curl -fsSL https://burger-api.com/install.sh | bash
91
+ ```
92
+
93
+ **Windows PowerShell:**
94
+
95
+ ```powershell
96
+ irm https://burger-api.com/install.ps1 | iex
97
+ ```
98
+
99
+ **Option 3: Manual Download (Alternative Installation Method)**
100
+
101
+ 1. Download the executable for your platform from
102
+ [GitHub Releases](https://github.com/isfhan/burger-api/releases/latest)
103
+ 2. Add to PATH
104
+ 3. Make executable (Linux/macOS): `chmod +x burger-api`
105
+
106
+ **Verify Installation (To Check if the CLI is Installed Correctly)**
107
+
108
+ ```bash
109
+ burger-api --version
110
+ ```
111
+
112
+ **Package Details:**
113
+
114
+ - **npm package:**
115
+ [`@burger-api/cli`](https://www.npmjs.com/package/@burger-api/cli)
116
+ - **Requires:** Bun >=1.3.0
117
+
118
+ ### Quick Start
119
+
120
+ ```bash
121
+ # Create a new burger-api project
122
+ burger-api create my-api
123
+
124
+ # Navigate to your project
125
+ cd my-api
126
+
127
+ # Start development server
128
+ bun run dev
129
+ ```
130
+
131
+ ### Installing Middleware
132
+
133
+ The CLI makes it easy to add production-ready middleware to your project. Browse
134
+ available middleware and install them with a single command:
135
+
136
+ ```bash
137
+ # List all available middleware
138
+ burger-api list
139
+
140
+ # Add middleware to your project
141
+ burger-api add cors logger rate-limiter
142
+ ```
143
+
144
+ **Popular Middleware Available:**
145
+
146
+ - **`cors`** - Cross-Origin Resource Sharing for handling cross-origin
147
+ requests
148
+ - **`logger`** - Request/response logging with detailed information
149
+ - **`rate-limiter`** - Request rate limiting to prevent API abuse
150
+ - **`jwt-auth`** - JWT authentication for securing your API endpoints
151
+ - **`api-key-auth`** - API key authentication for server-to-server
152
+ communication
153
+ - **`compression`** - Response compression (gzip/deflate) to reduce bandwidth
154
+ - **`security-headers`** - Security HTTP headers to protect against common
155
+ attacks
156
+ - **`cache`** - HTTP caching headers for improved performance
157
+ - **`timeout`** - Request timeout to prevent long-running requests
158
+ - **`body-size-limiter`** - Request body size limits to prevent large payload
159
+ attacks
160
+
161
+ After installing middleware, the CLI will show you exactly how to use it in your
162
+ project. For more information, visit the
163
+ [CLI documentation](../../packages/cli/README.md).
164
+
165
+ ## 📣 Changelog
166
+
167
+ ### Latest Version: 0.7.0 (December 24, 2025)
168
+
169
+ - 🔧 **CLI & Release Improvements:**
170
+ - Added CLI tool for creating new projects and managing middleware
171
+ - Updated README.md
172
+
173
+ ### Latest Version: 0.6.2 (November 13, 2025)
174
+
175
+ - ⚡ **Major Performance Improvements:**
176
+
177
+ - middleware execution with specialized fast paths
178
+ - AOT compilation with pre-computed middleware arrays
179
+ - Zero runtime allocations (pre-allocated arrays)
180
+ - Manual loop unrolling for 2-middleware case
181
+ - Reduced code from ~110 to ~80 lines
182
+
183
+ - 🎯 **Simplified Middleware System:**
184
+
185
+ - Clearer return types: Response, Function, or undefined
186
+ - Removed complex "around" middleware pattern
187
+ - Dedicated fast paths for 0, 1, and 2 middlewares
188
+ - Better JIT optimization
189
+
190
+ - 📦 **Monorepo Structure:**
191
+
192
+ - Converted to Bun workspace monorepo
193
+ - Core framework in `packages/burger-api`
194
+ - CLI tool in `packages/cli` (under development)
195
+ - Ecosystem middleware at root level
196
+
197
+ - 🔧 **Developer Experience:**
198
+ - 100% backward compatible
199
+ - Clearer documentation
200
+ - Easier to understand codebase
201
+
202
+ ### Previous Version: 0.5.2 (November 9, 2025)
203
+
204
+ - 🔧 **Internal Improvements:**
205
+ - Refactored wildcard parameter extraction logic into reusable utility
206
+ functions
207
+ - Added test suites and README files for all example projects
208
+
209
+ ### Previous Version: 0.5.0 (November 1, 2025)
210
+
211
+ - 🌟 **Feature:** Auto-injected OPTIONS handler for CORS preflight:
212
+
213
+ - Automatically injects an OPTIONS handler for CORS preflight when needed
214
+ - Only injects if the route defines any preflight-triggering methods and
215
+ lacks an OPTIONS handler
216
+ - Injects a minimal OPTIONS handler that returns a 204 No Content response
217
+ - Works for all HTTP methods that trigger CORS preflight (POST, PUT,
218
+ DELETE, PATCH)
219
+ - Does not inject if the route already has an OPTIONS handler
220
+
221
+ - 🌟 **Feature:** Improved response handling in middleware (after
222
+ middlewares):
223
+
224
+ - After middlewares now run even if the current middleware already
225
+ returned a response
226
+ - After middlewares run in reverse order to make changing the response
227
+ easier and to help with CORS
228
+
229
+ - 🐛 **Bug Fix:** Fixed TypeScript type resolution for package consumers:
230
+ - Users now get full IntelliSense, autocomplete, and type safety out of
231
+ the box
232
+
233
+ ### Previous Version: 0.4.0 (October 21, 2025)
234
+
235
+ - 🌟 **Feature:** Wildcard Routes:
236
+ - Added wildcard routes using `[...]` folder name - matches any path after
237
+ it
238
+ - Create routes that handle multiple path segments automatically
239
+ - Access all matched path parts through `wildcardParams` in your request
240
+ - Routes are matched in order: exact paths first, then dynamic routes
241
+ (like `[id]`), then wildcards last
242
+ - Works inside dynamic routes too (example: `/api/users/[userId]/[...]`)
243
+ - View wildcard routes in OpenAPI docs and Swagger UI
244
+
245
+ ### Previous Version: 0.3.0 (August 15, 2025)
246
+
247
+ - 🌟 **Feature:** Updated Zod to version 4:
248
+ - Updated Zod version from 3.x to 4.x
249
+ - Updated built-in request validation middleware to use Zod 4
250
+ - Updated and better request validation middleware error handling
251
+ - Removed Zod-to-json-schema dependency and use Zod 4 directly
252
+
253
+ For a complete list of changes, please check the
254
+ [Changelog](./packages/burger-api/CHANGELOG.md) file.
255
+
256
+ ## 🎯 What's Coming Next?
257
+
258
+ We're actively enhancing burger-api with powerful new features Stay tuned for
259
+ updates as we continue to build and improve burger-api! We're committed to
260
+ making it the best API framework for Bun.js.
261
+
262
+ ## 🤝 Contributing
263
+
264
+ We welcome contributions from the community! If you have suggestions or
265
+ improvements, please open an issue or submit a pull request. Let's build
266
+ something amazing together.
267
+
268
+ ## 📄 License
269
+
270
+ This project is licensed under the MIT License - see the
271
+ [LICENSE](./packages/burger-api/LICENSE) file for details.
272
+
273
+ The MIT License is a permissive license that is short and to the point. It lets
274
+ people do anything they want with your code as long as they provide attribution
275
+ back to you and don't hold you liable.
@@ -1,33 +1,33 @@
1
- export const swaggerHtml = `<!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>API Documentation</title>
6
- <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css" />
7
- <style>
8
- body {
9
- margin: 0;
10
- padding: 0;
11
- }
12
- </style>
13
- </head>
14
- <body>
15
- <div id="swagger-ui"></div>
16
- <script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
17
- <script>
18
- window.onload = function() {
19
- SwaggerUIBundle({
20
- url: '/openapi.json',
21
- dom_id: '#swagger-ui',
22
- presets: [
23
- SwaggerUIBundle.presets.apis,
24
- SwaggerUIBundle.SwaggerUIStandalonePreset
25
- ],
26
- layout: "BaseLayout",
27
- docExpansion: "none",
28
- filter: true,
29
- });
30
- };
31
- </script>
32
- </body>
1
+ export const swaggerHtml = `<!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>API Documentation</title>
6
+ <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css" />
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ padding: 0;
11
+ }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <div id="swagger-ui"></div>
16
+ <script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
17
+ <script>
18
+ window.onload = function() {
19
+ SwaggerUIBundle({
20
+ url: '/openapi.json',
21
+ dom_id: '#swagger-ui',
22
+ presets: [
23
+ SwaggerUIBundle.presets.apis,
24
+ SwaggerUIBundle.SwaggerUIStandalonePreset
25
+ ],
26
+ layout: "BaseLayout",
27
+ docExpansion: "none",
28
+ filter: true,
29
+ });
30
+ };
31
+ </script>
32
+ </body>
33
33
  </html>`;
@@ -24,7 +24,7 @@ export function errorResponse(error, req, debug) {
24
24
  console.error(`${logPrefix} Error:`, error);
25
25
  const acceptHeader = req.headers.get('accept') || '';
26
26
  if (acceptHeader.includes('text/html') && debug) {
27
- const body = `<!doctype html><html lang="en"><meta charset="UTF-8"><title>Error Occurred - BurgerAPI</title><style>body{margin:0;padding:0;background-color:#f4f4f4;font-family:Nunito,sans-serif;color:#333}.whoops-container{width:80%;margin:5% auto;background:#fff;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);overflow:hidden}.whoops-header{background-color:#e74c3c;color:#fff;padding:20px;display:flex;align-items:center;justify-content:space-between}.whoops-header .title-container{display:flex;align-items:center}.whoops-header .title{font-size:1.5em;margin-left:10px}.whoops-header .debug-mode{font-weight:600;display:flex;align-items:center;padding:10px;background-color:#fff;color:#e74c3c;box-shadow:0 4px 12px rgba(0,0,0,.15);border-radius:8px}.whoops-header .debug-mode .fa-check-circle{color:#28a745;margin-right:5px;font-size:1.2em}.whoops-content{padding:2em}.tag{font-weight:600;color:#4a5568;background-color:#edf2f7;padding:8px 15px;border-radius:6px;display:inline-block;font-size:14px}.error-message{font-size:1.25em;line-height:1.6;margin-bottom:1.5em;color:#2d3748}h2{color:#e3342f;font-size:1.5em;margin-bottom:.8em;border-bottom:1px solid #edf2f7;padding-bottom:.5em}pre{background:#f9fafc;border-left:4px solid #e3342f;padding:1.5em;border-radius:4px;font-family:"Source Code Pro",Menlo,Monaco,Consolas,"Courier New",monospace;font-size:1em;line-height:1.6;overflow-x:auto;color:#4a5568}.footer{text-align:center;padding-top:25px;font-size:.9em;color:#718096;border-top:1px solid #edf2f7}.error-icon{font-size:2em}.request-info{display:flex;justify-content:space-between;align-items:center}</style><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"rel="stylesheet"><div class="whoops-container"><div class="whoops-header"><div class="title-container"><i class="fas error-icon fa-exclamation-triangle"></i><div class="title">Whoops! Something went wrong</div></div><div class="debug-mode"><i class="fas fa-check-circle"></i> Debug Mode Enabled</div></div><div class="whoops-content"><div class="request-info"><div><strong>Request:</strong> ${method} ${url}</div><div class="tag">${error.stack?.split('\n')[0].split(':')[0]}</div></div><p class="error-message">${error.message}<h2>Stack Trace</h2><pre>${error.stack || 'No stack trace available'}</pre><div class="footer">“It’s not a bug, it’s an undocumented feature.” — Anonymous</div></div></div>
27
+ const body = `<!doctype html><html lang="en"><meta charset="UTF-8"><title>Error Occurred - BurgerAPI</title><style>body{margin:0;padding:0;background-color:#f4f4f4;font-family:Nunito,sans-serif;color:#333}.whoops-container{width:80%;margin:5% auto;background:#fff;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);overflow:hidden}.whoops-header{background-color:#e74c3c;color:#fff;padding:20px;display:flex;align-items:center;justify-content:space-between}.whoops-header .title-container{display:flex;align-items:center}.whoops-header .title{font-size:1.5em;margin-left:10px}.whoops-header .debug-mode{font-weight:600;display:flex;align-items:center;padding:10px;background-color:#fff;color:#e74c3c;box-shadow:0 4px 12px rgba(0,0,0,.15);border-radius:8px}.whoops-header .debug-mode .fa-check-circle{color:#28a745;margin-right:5px;font-size:1.2em}.whoops-content{padding:2em}.tag{font-weight:600;color:#4a5568;background-color:#edf2f7;padding:8px 15px;border-radius:6px;display:inline-block;font-size:14px}.error-message{font-size:1.25em;line-height:1.6;margin-bottom:1.5em;color:#2d3748}h2{color:#e3342f;font-size:1.5em;margin-bottom:.8em;border-bottom:1px solid #edf2f7;padding-bottom:.5em}pre{background:#f9fafc;border-left:4px solid #e3342f;padding:1.5em;border-radius:4px;font-family:"Source Code Pro",Menlo,Monaco,Consolas,"Courier New",monospace;font-size:1em;line-height:1.6;overflow-x:auto;color:#4a5568}.footer{text-align:center;padding-top:25px;font-size:.9em;color:#718096;border-top:1px solid #edf2f7}.error-icon{font-size:2em}.request-info{display:flex;justify-content:space-between;align-items:center}</style><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"rel="stylesheet"><div class="whoops-container"><div class="whoops-header"><div class="title-container"><i class="fas error-icon fa-exclamation-triangle"></i><div class="title">Whoops! Something went wrong</div></div><div class="debug-mode"><i class="fas fa-check-circle"></i> Debug Mode Enabled</div></div><div class="whoops-content"><div class="request-info"><div><strong>Request:</strong> ${method} ${url}</div><div class="tag">${error.stack?.split('\n')[0].split(':')[0]}</div></div><p class="error-message">${error.message}<h2>Stack Trace</h2><pre>${error.stack || 'No stack trace available'}</pre><div class="footer">“It’s not a bug, it’s an undocumented feature.” — Anonymous</div></div></div>
28
28
  `;
29
29
  // Return the html response
30
30
  return new Response(body, {
package/package.json CHANGED
@@ -1,89 +1,89 @@
1
- {
2
- "name": "burger-api",
3
- "version": "0.6.2",
4
- "author": "Isfhan Ahmed",
5
- "type": "module",
6
- "module": "dist/src/index.js",
7
- "types": "dist/src/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "typecheck": "tsc --noEmit",
13
- "build": "tsc --project tsconfig.build.json",
14
- "prepare": "bun run build",
15
- "test": "bun test",
16
- "dev": "bun run examples/file-base-static-page-routing-app/index.ts"
17
- },
18
- "keywords": [
19
- "burger-api",
20
- "burger-api-framework",
21
- "bun",
22
- "bunjs",
23
- "bun-framework",
24
- "fast-backend",
25
- "javascript-backend",
26
- "high-performance",
27
- "esm",
28
- "typescript",
29
- "openapi",
30
- "swagger-ui",
31
- "declarative-routing",
32
- "api-framework",
33
- "modern-backend",
34
- "backend-framework",
35
- "server",
36
- "bun-native",
37
- "js-backend",
38
- "fast-api",
39
- "scalable-backend",
40
- "backend-development",
41
- "modern-api",
42
- "api-development",
43
- "backend-engine",
44
- "efficient",
45
- "minimalist-backend",
46
- "bun-powered",
47
- "open-source",
48
- "typescript-backend",
49
- "performance",
50
- "rapid-development",
51
- "web-framework",
52
- "api-server",
53
- "dynamic-routing",
54
- "backend-routing",
55
- "extensible",
56
- "modular",
57
- "declarative-api",
58
- "lightweight",
59
- "contemporary-backend",
60
- "fast-javascript",
61
- "bun-js-framework",
62
- "bun-backend",
63
- "bun-api-framework",
64
- "pakistan-backend",
65
- "pakistan-api-framework",
66
- "pakistan-api-server",
67
- "pakistan-backend-framework",
68
- "pakistan-bunjs-framework",
69
- "pakistan-javascript-framework"
70
- ],
71
- "license": "MIT",
72
- "repository": {
73
- "type": "git",
74
- "url": "git+https://github.com/isfhan/burger-api.git"
75
- },
76
- "bugs": {
77
- "url": "https://github.com/isfhan/burger-api/issues"
78
- },
79
- "homepage": "https://burger-api.com",
80
- "dependencies": {
81
- "zod": "^4.0.17"
82
- },
83
- "devDependencies": {
84
- "@types/bun": "latest"
85
- },
86
- "peerDependencies": {
87
- "typescript": "^5.7.3"
88
- }
1
+ {
2
+ "name": "burger-api",
3
+ "version": "0.7.1",
4
+ "author": "Isfhan Ahmed",
5
+ "type": "module",
6
+ "module": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "typecheck": "tsc --noEmit",
13
+ "build": "tsc --project tsconfig.build.json",
14
+ "prepare": "bun run build",
15
+ "test": "bun test",
16
+ "dev": "bun run examples/file-base-static-page-routing-app/index.ts"
17
+ },
18
+ "keywords": [
19
+ "burger-api",
20
+ "burger-api-framework",
21
+ "bun",
22
+ "bunjs",
23
+ "bun-framework",
24
+ "fast-backend",
25
+ "javascript-backend",
26
+ "high-performance",
27
+ "esm",
28
+ "typescript",
29
+ "openapi",
30
+ "swagger-ui",
31
+ "declarative-routing",
32
+ "api-framework",
33
+ "modern-backend",
34
+ "backend-framework",
35
+ "server",
36
+ "bun-native",
37
+ "js-backend",
38
+ "fast-api",
39
+ "scalable-backend",
40
+ "backend-development",
41
+ "modern-api",
42
+ "api-development",
43
+ "backend-engine",
44
+ "efficient",
45
+ "minimalist-backend",
46
+ "bun-powered",
47
+ "open-source",
48
+ "typescript-backend",
49
+ "performance",
50
+ "rapid-development",
51
+ "web-framework",
52
+ "api-server",
53
+ "dynamic-routing",
54
+ "backend-routing",
55
+ "extensible",
56
+ "modular",
57
+ "declarative-api",
58
+ "lightweight",
59
+ "contemporary-backend",
60
+ "fast-javascript",
61
+ "bun-js-framework",
62
+ "bun-backend",
63
+ "bun-api-framework",
64
+ "pakistan-backend",
65
+ "pakistan-api-framework",
66
+ "pakistan-api-server",
67
+ "pakistan-backend-framework",
68
+ "pakistan-bunjs-framework",
69
+ "pakistan-javascript-framework"
70
+ ],
71
+ "license": "MIT",
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "git+https://github.com/isfhan/burger-api.git"
75
+ },
76
+ "bugs": {
77
+ "url": "https://github.com/isfhan/burger-api/issues"
78
+ },
79
+ "homepage": "https://burger-api.com",
80
+ "dependencies": {
81
+ "zod": "^4.0.17"
82
+ },
83
+ "devDependencies": {
84
+ "@types/bun": "latest"
85
+ },
86
+ "peerDependencies": {
87
+ "typescript": "^5.7.3"
88
+ }
89
89
  }