burger-api 0.6.2 → 0.7.0
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 +20 -20
- package/README.md +261 -166
- package/dist/src/core/swagger-ui.js +32 -32
- package/dist/src/utils/error.js +1 -1
- package/package.json +88 -88
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,261 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](https://github.com/isfhan/burger-api)
|
|
8
|
+
[](./packages/burger-api/LICENSE)
|
|
9
|
+
[](https://bun.sh)
|
|
10
|
+
[](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: npm/bun (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
|
+
bunx @burger-api/cli create my-project
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Option 2: Standalone Executable**
|
|
84
|
+
|
|
85
|
+
**macOS, Linux, WSL:**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
curl -fsSL https://burger-api.com/install.sh | bash
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Windows PowerShell:**
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
irm https://burger-api.com/install.ps1 | iex
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Or download the executable from
|
|
98
|
+
[GitHub Releases](https://github.com/isfhan/burger-api/releases/latest).
|
|
99
|
+
|
|
100
|
+
**Package Details:**
|
|
101
|
+
- **npm package:** [`@burger-api/cli`](https://www.npmjs.com/package/@burger-api/cli)
|
|
102
|
+
- **Requires:** Bun >=1.3.0
|
|
103
|
+
|
|
104
|
+
### Quick Start
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Create a new burger-api project
|
|
108
|
+
burger-api create my-api
|
|
109
|
+
|
|
110
|
+
# Navigate to your project
|
|
111
|
+
cd my-api
|
|
112
|
+
|
|
113
|
+
# Start development server
|
|
114
|
+
bun run dev
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Installing Middleware
|
|
118
|
+
|
|
119
|
+
The CLI makes it easy to add production-ready middleware to your project. Browse
|
|
120
|
+
available middleware and install them with a single command:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# List all available middleware
|
|
124
|
+
burger-api list
|
|
125
|
+
|
|
126
|
+
# Add middleware to your project
|
|
127
|
+
burger-api add cors logger rate-limiter
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Popular Middleware Available:**
|
|
131
|
+
|
|
132
|
+
- **`cors`** - Cross-Origin Resource Sharing for handling cross-origin
|
|
133
|
+
requests
|
|
134
|
+
- **`logger`** - Request/response logging with detailed information
|
|
135
|
+
- **`rate-limiter`** - Request rate limiting to prevent API abuse
|
|
136
|
+
- **`jwt-auth`** - JWT authentication for securing your API endpoints
|
|
137
|
+
- **`api-key-auth`** - API key authentication for server-to-server
|
|
138
|
+
communication
|
|
139
|
+
- **`compression`** - Response compression (gzip/deflate) to reduce bandwidth
|
|
140
|
+
- **`security-headers`** - Security HTTP headers to protect against common
|
|
141
|
+
attacks
|
|
142
|
+
- **`cache`** - HTTP caching headers for improved performance
|
|
143
|
+
- **`timeout`** - Request timeout to prevent long-running requests
|
|
144
|
+
- **`body-size-limiter`** - Request body size limits to prevent large payload
|
|
145
|
+
attacks
|
|
146
|
+
|
|
147
|
+
After installing middleware, the CLI will show you exactly how to use it in your
|
|
148
|
+
project. For more information, visit the
|
|
149
|
+
[CLI documentation](../../packages/cli/README.md).
|
|
150
|
+
|
|
151
|
+
## 📣 Changelog
|
|
152
|
+
|
|
153
|
+
### Latest Version: 0.7.0 (December 24, 2025)
|
|
154
|
+
|
|
155
|
+
- 🔧 **CLI & Release Improvements:**
|
|
156
|
+
- Added CLI tool for creating new projects and managing middleware
|
|
157
|
+
- Updated README.md
|
|
158
|
+
|
|
159
|
+
### Latest Version: 0.6.2 (November 13, 2025)
|
|
160
|
+
|
|
161
|
+
- ⚡ **Major Performance Improvements:**
|
|
162
|
+
|
|
163
|
+
- middleware execution with specialized fast paths
|
|
164
|
+
- AOT compilation with pre-computed middleware arrays
|
|
165
|
+
- Zero runtime allocations (pre-allocated arrays)
|
|
166
|
+
- Manual loop unrolling for 2-middleware case
|
|
167
|
+
- Reduced code from ~110 to ~80 lines
|
|
168
|
+
|
|
169
|
+
- 🎯 **Simplified Middleware System:**
|
|
170
|
+
|
|
171
|
+
- Clearer return types: Response, Function, or undefined
|
|
172
|
+
- Removed complex "around" middleware pattern
|
|
173
|
+
- Dedicated fast paths for 0, 1, and 2 middlewares
|
|
174
|
+
- Better JIT optimization
|
|
175
|
+
|
|
176
|
+
- 📦 **Monorepo Structure:**
|
|
177
|
+
|
|
178
|
+
- Converted to Bun workspace monorepo
|
|
179
|
+
- Core framework in `packages/burger-api`
|
|
180
|
+
- CLI tool in `packages/cli` (under development)
|
|
181
|
+
- Ecosystem middleware at root level
|
|
182
|
+
|
|
183
|
+
- 🔧 **Developer Experience:**
|
|
184
|
+
- 100% backward compatible
|
|
185
|
+
- Clearer documentation
|
|
186
|
+
- Easier to understand codebase
|
|
187
|
+
|
|
188
|
+
### Previous Version: 0.5.2 (November 9, 2025)
|
|
189
|
+
|
|
190
|
+
- 🔧 **Internal Improvements:**
|
|
191
|
+
- Refactored wildcard parameter extraction logic into reusable utility
|
|
192
|
+
functions
|
|
193
|
+
- Added test suites and README files for all example projects
|
|
194
|
+
|
|
195
|
+
### Previous Version: 0.5.0 (November 1, 2025)
|
|
196
|
+
|
|
197
|
+
- 🌟 **Feature:** Auto-injected OPTIONS handler for CORS preflight:
|
|
198
|
+
|
|
199
|
+
- Automatically injects an OPTIONS handler for CORS preflight when needed
|
|
200
|
+
- Only injects if the route defines any preflight-triggering methods and
|
|
201
|
+
lacks an OPTIONS handler
|
|
202
|
+
- Injects a minimal OPTIONS handler that returns a 204 No Content response
|
|
203
|
+
- Works for all HTTP methods that trigger CORS preflight (POST, PUT,
|
|
204
|
+
DELETE, PATCH)
|
|
205
|
+
- Does not inject if the route already has an OPTIONS handler
|
|
206
|
+
|
|
207
|
+
- 🌟 **Feature:** Improved response handling in middleware (after
|
|
208
|
+
middlewares):
|
|
209
|
+
|
|
210
|
+
- After middlewares now run even if the current middleware already
|
|
211
|
+
returned a response
|
|
212
|
+
- After middlewares run in reverse order to make changing the response
|
|
213
|
+
easier and to help with CORS
|
|
214
|
+
|
|
215
|
+
- 🐛 **Bug Fix:** Fixed TypeScript type resolution for package consumers:
|
|
216
|
+
- Users now get full IntelliSense, autocomplete, and type safety out of
|
|
217
|
+
the box
|
|
218
|
+
|
|
219
|
+
### Previous Version: 0.4.0 (October 21, 2025)
|
|
220
|
+
|
|
221
|
+
- 🌟 **Feature:** Wildcard Routes:
|
|
222
|
+
- Added wildcard routes using `[...]` folder name - matches any path after
|
|
223
|
+
it
|
|
224
|
+
- Create routes that handle multiple path segments automatically
|
|
225
|
+
- Access all matched path parts through `wildcardParams` in your request
|
|
226
|
+
- Routes are matched in order: exact paths first, then dynamic routes
|
|
227
|
+
(like `[id]`), then wildcards last
|
|
228
|
+
- Works inside dynamic routes too (example: `/api/users/[userId]/[...]`)
|
|
229
|
+
- View wildcard routes in OpenAPI docs and Swagger UI
|
|
230
|
+
|
|
231
|
+
### Previous Version: 0.3.0 (August 15, 2025)
|
|
232
|
+
|
|
233
|
+
- 🌟 **Feature:** Updated Zod to version 4:
|
|
234
|
+
- Updated Zod version from 3.x to 4.x
|
|
235
|
+
- Updated built-in request validation middleware to use Zod 4
|
|
236
|
+
- Updated and better request validation middleware error handling
|
|
237
|
+
- Removed Zod-to-json-schema dependency and use Zod 4 directly
|
|
238
|
+
|
|
239
|
+
For a complete list of changes, please check the
|
|
240
|
+
[Changelog](./packages/burger-api/CHANGELOG.md) file.
|
|
241
|
+
|
|
242
|
+
## 🎯 What's Coming Next?
|
|
243
|
+
|
|
244
|
+
We're actively enhancing burger-api with powerful new features Stay tuned for
|
|
245
|
+
updates as we continue to build and improve burger-api! We're committed to
|
|
246
|
+
making it the best API framework for Bun.js.
|
|
247
|
+
|
|
248
|
+
## 🤝 Contributing
|
|
249
|
+
|
|
250
|
+
We welcome contributions from the community! If you have suggestions or
|
|
251
|
+
improvements, please open an issue or submit a pull request. Let's build
|
|
252
|
+
something amazing together.
|
|
253
|
+
|
|
254
|
+
## 📄 License
|
|
255
|
+
|
|
256
|
+
This project is licensed under the MIT License - see the
|
|
257
|
+
[LICENSE](./packages/burger-api/LICENSE) file for details.
|
|
258
|
+
|
|
259
|
+
The MIT License is a permissive license that is short and to the point. It lets
|
|
260
|
+
people do anything they want with your code as long as they provide attribution
|
|
261
|
+
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>`;
|
package/dist/src/utils/error.js
CHANGED
|
@@ -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.
|
|
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.0",
|
|
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
|
}
|