Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ttoss/http-server

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ttoss/http-server - npm Package Compare versions

Comparing version
0.5.13
to
0.5.14
+94
dist/index.cjs
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) {
__defProp(to, key, {
get: (k => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
}
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
let _koa_bodyparser = require("@koa/bodyparser");
let _koa_cors = require("@koa/cors");
_koa_cors = __toESM(_koa_cors, 1);
let _koa_multer = require("@koa/multer");
_koa_multer = __toESM(_koa_multer, 1);
let _koa_router = require("@koa/router");
_koa_router = __toESM(_koa_router, 1);
let koa = require("koa");
koa = __toESM(koa, 1);
let koa_static = require("koa-static");
koa_static = __toESM(koa_static, 1);
//#region src/addHealthCheck.ts
/**
* Adds a health check endpoint to the Koa application.
*
* @example
* ```typescript
* import { App, addHealthCheck } from '@ttoss/http-server';
*
* const app = new App();
* addHealthCheck({ app });
*
* app.listen(3000);
* // GET /health returns { status: 'ok' }
* ```
*
* @example
* ```typescript
* // Custom path
* addHealthCheck({ app, path: '/health' });
* ```
*/
const addHealthCheck = ({
app,
path = "/health"
}) => {
const router = new _koa_router.default();
router.get(path, ctx => {
ctx.body = {
status: "ok"
};
});
app.use(router.routes());
app.use(router.allowedMethods());
};
//#endregion
exports.App = koa.default;
exports.Router = _koa_router.default;
exports.addHealthCheck = addHealthCheck;
exports.bodyParser = _koa_bodyparser.bodyParser;
exports.cors = _koa_cors.default;
exports.multer = _koa_multer.default;
exports.serve = koa_static.default;
Object.keys(_koa_router).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () {
return _koa_router[k];
}
});
});
import { bodyParser } from "@koa/bodyparser";
import cors from "@koa/cors";
import multer, { File as MulterFile } from "@koa/multer";
import Router, { RouterContext } from "@koa/router";
import App, { default as App$1 } from "koa";
import serve from "koa-static";
export * from "@koa/router";
//#region src/addHealthCheck.d.ts
interface AddHealthCheckOptions {
/**
* The Koa application instance to attach the health check to.
*/
app: App$1;
/**
* The path for the health endpoint.
* @default '/health'
*/
path?: string;
}
/**
* Adds a health check endpoint to the Koa application.
*
* @example
* ```typescript
* import { App, addHealthCheck } from '@ttoss/http-server';
*
* const app = new App();
* addHealthCheck({ app });
*
* app.listen(3000);
* // GET /health returns { status: 'ok' }
* ```
*
* @example
* ```typescript
* // Custom path
* addHealthCheck({ app, path: '/health' });
* ```
*/
declare const addHealthCheck: ({
app,
path
}: AddHealthCheckOptions) => void;
//#endregion
export { AddHealthCheckOptions, App, type MulterFile, Router, type RouterContext, addHealthCheck, bodyParser, cors, multer, serve };
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
import { bodyParser } from "@koa/bodyparser";
import cors from "@koa/cors";
import multer from "@koa/multer";
import Router, { default as Router$1 } from "@koa/router";
import App from "koa";
import serve from "koa-static";
export * from "@koa/router";
//#region src/addHealthCheck.ts
/**
* Adds a health check endpoint to the Koa application.
*
* @example
* ```typescript
* import { App, addHealthCheck } from '@ttoss/http-server';
*
* const app = new App();
* addHealthCheck({ app });
*
* app.listen(3000);
* // GET /health returns { status: 'ok' }
* ```
*
* @example
* ```typescript
* // Custom path
* addHealthCheck({ app, path: '/health' });
* ```
*/
const addHealthCheck = ({
app,
path = "/health"
}) => {
const router = new Router$1();
router.get(path, ctx => {
ctx.body = {
status: "ok"
};
});
app.use(router.routes());
app.use(router.allowedMethods());
};
//#endregion
export { App, Router, addHealthCheck, bodyParser, cors, multer, serve };
+24
-20

@@ -1,20 +0,21 @@

export { bodyParser } from '@koa/bodyparser';
export { default as cors } from '@koa/cors';
export { File as MulterFile, default as multer } from '@koa/multer';
export * from '@koa/router';
export { default as Router, RouterContext } from '@koa/router';
import App from 'koa';
export { default as App } from 'koa';
export { default as serve } from 'koa-static';
import { bodyParser } from "@koa/bodyparser";
import cors from "@koa/cors";
import multer, { File as MulterFile } from "@koa/multer";
import Router, { RouterContext } from "@koa/router";
import App, { default as App$1 } from "koa";
import serve from "koa-static";
export * from "@koa/router";
//#region src/addHealthCheck.d.ts
interface AddHealthCheckOptions {
/**
* The Koa application instance to attach the health check to.
*/
app: App;
/**
* The path for the health endpoint.
* @default '/health'
*/
path?: string;
/**
* The Koa application instance to attach the health check to.
*/
app: App$1;
/**
* The path for the health endpoint.
* @default '/health'
*/
path?: string;
}

@@ -41,4 +42,7 @@ /**

*/
declare const addHealthCheck: ({ app, path, }: AddHealthCheckOptions) => void;
export { type AddHealthCheckOptions, addHealthCheck };
declare const addHealthCheck: ({
app,
path
}: AddHealthCheckOptions) => void;
//#endregion
export { AddHealthCheckOptions, App, type MulterFile, Router, type RouterContext, addHealthCheck, bodyParser, cors, multer, serve };
{
"name": "@ttoss/http-server",
"version": "0.5.13",
"version": "0.5.14",
"description": "HTTP Server for ttoss environment",

@@ -47,4 +47,4 @@ "keywords": [

"supertest": "^7.2.2",
"tsup": "^8.5.1",
"@ttoss/config": "^1.37.12"
"tsdown": "^0.22.0",
"@ttoss/config": "^1.37.13"
},

@@ -56,5 +56,5 @@ "publishConfig": {

"scripts": {
"build": "tsup",
"build": "tsdown",
"test": "jest --projects tests/unit"
}
}
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
value,
configurable: true
});
// src/index.ts
import { bodyParser } from "@koa/bodyparser";
import cors from "@koa/cors";
import multer from "@koa/multer";
import Router2 from "@koa/router";
import App from "koa";
import serve from "koa-static";
// src/addHealthCheck.ts
import Router from "@koa/router";
var addHealthCheck = /* @__PURE__ */__name(({
app,
path = "/health"
}) => {
const router = new Router();
router.get(path, ctx => {
ctx.body = {
status: "ok"
};
});
app.use(router.routes());
app.use(router.allowedMethods());
}, "addHealthCheck");
// src/index.ts
export * from "@koa/router";
export { App, Router2 as Router, addHealthCheck, bodyParser, cors, multer, serve };
export { bodyParser } from '@koa/bodyparser';
export { default as cors } from '@koa/cors';
export { File as MulterFile, default as multer } from '@koa/multer';
export * from '@koa/router';
export { default as Router, RouterContext } from '@koa/router';
import App from 'koa';
export { default as App } from 'koa';
export { default as serve } from 'koa-static';
interface AddHealthCheckOptions {
/**
* The Koa application instance to attach the health check to.
*/
app: App;
/**
* The path for the health endpoint.
* @default '/health'
*/
path?: string;
}
/**
* Adds a health check endpoint to the Koa application.
*
* @example
* ```typescript
* import { App, addHealthCheck } from '@ttoss/http-server';
*
* const app = new App();
* addHealthCheck({ app });
*
* app.listen(3000);
* // GET /health returns { status: 'ok' }
* ```
*
* @example
* ```typescript
* // Custom path
* addHealthCheck({ app, path: '/health' });
* ```
*/
declare const addHealthCheck: ({ app, path, }: AddHealthCheckOptions) => void;
export { type AddHealthCheckOptions, addHealthCheck };
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", {
value,
configurable: true
});
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
value: true
}), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
App: () => import_koa.default,
Router: () => import_router2.default,
addHealthCheck: () => addHealthCheck,
bodyParser: () => import_bodyparser.bodyParser,
cors: () => import_cors.default,
multer: () => import_multer.default,
serve: () => import_koa_static.default
});
module.exports = __toCommonJS(index_exports);
var import_bodyparser = require("@koa/bodyparser");
var import_cors = __toESM(require("@koa/cors"), 1);
var import_multer = __toESM(require("@koa/multer"), 1);
var import_router2 = __toESM(require("@koa/router"), 1);
var import_koa = __toESM(require("koa"), 1);
var import_koa_static = __toESM(require("koa-static"), 1);
// src/addHealthCheck.ts
var import_router = __toESM(require("@koa/router"), 1);
var addHealthCheck = /* @__PURE__ */__name(({
app,
path = "/health"
}) => {
const router = new import_router.default();
router.get(path, ctx => {
ctx.body = {
status: "ok"
};
});
app.use(router.routes());
app.use(router.allowedMethods());
}, "addHealthCheck");
// src/index.ts
__reExport(index_exports, require("@koa/router"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
App,
Router,
addHealthCheck,
bodyParser,
cors,
multer,
serve,
...require("@koa/router")
});