import { t, HttpContext } from '@breezeapi/core';
import { sendToChannel } from '@breezeapi/discord';
export const GET_config = {
querys: t.object({ name: t.string() }),
response: t.string(),
};
export async function GET(ctx: HttpContext) {
const name = ctx.querys?.name || "No name";
await sendToChannel('1364724391392579695', `New registration: ${name}`);
return Response.json({ name });
}Features that make development a breeze
Some of the features we offer to help you build your API faster.
File-based Routing
Create routes by simply adding files to your project. BreezeAPI automatically maps your file structure to endpoints.
Builtin Sync Layer
BreezeAPI comes with a built-in sync layer, that allowes you to sync your websocket data with your database.
Plugin System
We allow you to build your own plugins, that can deeply integrate into the framework and make it even more powerful.
Multi Protocoll Support
Add Websockets, http routes, tRCP or TCP to your API just by adding a file. No config required!
Get started in seconds
BreezeAPI is designed to be simple to set up and use
# Install BreezeAPI
bun add @breezeapi/core
# Initialize a new project
coming soon...
Documentation out of the box
BreezeAPI automatically generates Documentation for your API endpoints and all other supported protocols. This is still experimental and does currently not contain a option to add it as ui.
- OpenAPI compatible
- No config required
- Automatic route discovery
- Disable it if you don't need it
BreezeAPI Documentation
v1.0.0Get all users
Create a new user
Get a user by ID
export function open(ctx) {
// Handle connection logic here
}
export function message(ctx, msg) {
let parsed;
try {
parsed = JSON.parse(msg);
} catch {
ctx.send(JSON.stringify({ type: 'error', error: 'Invalid JSON' }));
return;
}
if (!parsed.user || !parsed.text) {
ctx.send(JSON.stringify({ type: 'error', error: 'Missing user or text' }));
return;
}
// Handle the message (e.g., echo or broadcast)
ctx.send(JSON.stringify({ type: 'message', user: parsed.user, text: parsed.text, ts: Date.now() }));
}
export function close(ctx) {
// Handle cleanup here
}