@backan/core
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -20,3 +20,2 @@ import { Context } from 'hono'; | ||
* description: 'API documentation for BACKAN Example', | ||
* port: 1312, | ||
* cors: { | ||
@@ -27,3 +26,3 @@ * origin: '*', | ||
* }); | ||
* @see https://backan.pigeonposse.com/guide/lib/app | ||
* @see https://backan.pigeonposse.com/guide/core/app | ||
*/ | ||
@@ -33,6 +32,2 @@ export declare class App<Env extends object> extends AppSuper<Env> { | ||
/** | ||
* The port on which the application will listen. Defaults to 80. | ||
*/ | ||
port: number; | ||
/** | ||
* The version of the application. | ||
@@ -56,3 +51,3 @@ */ | ||
} | undefined; | ||
constructor({ jsonResponse, cors, version, title, description, docs, health, port, contact, }: AppParameters); | ||
constructor({ jsonResponse, cors, version, title, description, docs, health, contact, }: AppParameters); | ||
/** | ||
@@ -98,8 +93,2 @@ * The fetch method for the application. | ||
}; | ||
/** | ||
* The port on which the application should run. | ||
* | ||
* Note: This cannot modify the server port. The use of this variable is to establish more precise user information. It is recommended to set it. | ||
*/ | ||
port?: number; | ||
/** Whether to format JSON responses prettily. */ | ||
@@ -125,3 +114,3 @@ jsonResponse?: boolean; | ||
* | ||
* @default '/dcos' | ||
* @default '/docs' | ||
*/ | ||
@@ -132,3 +121,3 @@ path?: string; | ||
* | ||
* @default true | ||
* @default true | ||
*/ | ||
@@ -146,7 +135,2 @@ active?: boolean; | ||
}; | ||
/** Custom error messages for the application. */ | ||
msg?: { | ||
/** Custom message for a 400 Bad Request error. */ | ||
error400?: string; | ||
}; | ||
}; | ||
@@ -468,3 +452,3 @@ | ||
* @example https://github.com/BimaAdi/Integrate-hono-with-openapi/blob/main/src/index.ts | ||
* @see https://backan.pigeonposse.com/guide/lib/route | ||
* @see https://backan.pigeonposse.com/guide/core/route | ||
*/ | ||
@@ -479,7 +463,7 @@ export declare class Route<Env extends object, Path extends string> extends AppSuper<Env> { | ||
*/ | ||
add: typeof Route.app.openapi; | ||
add: AppSuper<Env>['app']['openapi']; | ||
constructor(params: RouteParams<Path>); | ||
} | ||
declare type RouteParams<Path extends string> = { | ||
export declare type RouteParams<Path extends string> = { | ||
/** | ||
@@ -486,0 +470,0 @@ * The path of the route. |
@@ -5,3 +5,2 @@ import { prettyJSON } from "hono/pretty-json"; | ||
import { z, OpenAPIHono } from "@hono/zod-openapi"; | ||
const defaultPort = 80; | ||
const RESPONSE_MESSAGES = { | ||
@@ -39,3 +38,3 @@ /** | ||
*/ | ||
ERROR_PAGE_NOT_FOUND: "Page not found.", | ||
ERROR_PAGE_NOT_FOUND: "Page not found", | ||
/** | ||
@@ -408,6 +407,2 @@ * Message indicating a validation error. | ||
/** | ||
* The port on which the application will listen. Defaults to 80. | ||
*/ | ||
port = defaultPort; | ||
/** | ||
* The version of the application. | ||
@@ -460,3 +455,3 @@ */ | ||
const route = getHealthRoute(this.#health.path, this.#health.opts); | ||
this.app.route(route.path, route.app); | ||
this.addRoute(route); | ||
} | ||
@@ -471,3 +466,2 @@ constructor({ | ||
health, | ||
port, | ||
contact | ||
@@ -477,3 +471,2 @@ }) { | ||
if (jsonResponse) this.#jsonResponse = jsonResponse; | ||
if (port) this.port = port; | ||
if (version) this.version = version; | ||
@@ -483,3 +476,5 @@ if (title) this.title = title; | ||
if (description) this.description = description; | ||
if (this.#jsonResponse) this.app.use(prettyJSON()); | ||
if (this.#jsonResponse) this.app.use(prettyJSON({ | ||
space: 4 | ||
})); | ||
if (cors$1) this.app.use("*", cors(cors$1)); | ||
@@ -486,0 +481,0 @@ if (docs?.active || docs?.active == false) this.#docs.active = docs.active; |
{ | ||
"name": "@backan/core", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"type": "module", | ||
"license": "GPL-3.0", | ||
"homepage": "https://backan.pigeonposse.com/guide/core", | ||
"homepage": "https://backan.pigeonposse.com", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -1,3 +0,6 @@ | ||
# Backan - All in one web API builder | ||
# 🔥 Backan - Core | ||
**All in one web API builder**. | ||
Create endpoints with type validations and OpenApi documentation, safely and quickly | ||
<!-- PIGEONPOSSE START HEADER --> | ||
@@ -29,4 +32,5 @@ | ||
- 📙 [Library](https://backan.pigeonposse.com/guide/core) | ||
- 🏁 [Create (setup)]( https://backan.pigeonposse.com/guide/create ) | ||
- 🖥️ [Server]( https://backan.pigeonposse.com/guide/server ) | ||
- 🐳 [Builder]( https://backan.pigeonposse.com/guide/builder ) | ||
- 📦 [Builder]( https://backan.pigeonposse.com/guide/builder ) | ||
- [Installation](https://backan.pigeonposse.com/guide/core/#installation) | ||
@@ -33,0 +37,0 @@ <!-- PIGEONPOSSE END INDEX --> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125
75763
1038