mikroserve 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - Supports custom middlewares
14
14
  - Out-of-the-box CORS support
15
15
  - Built-in customizable rate limiter
16
- - Tiny (~4.9kb gzipped)
16
+ - Tiny (~4.8kb gzipped)
17
17
  - Only a single dependency: [MikroConf](https://github.com/mikaelvesavuori/mikroconf)
18
18
 
19
19
  ## Installation
package/lib/MikroServe.js CHANGED
@@ -494,7 +494,10 @@ var MikroServe = class {
494
494
  });
495
495
  }
496
496
  const result = await this.router.handle(req, res);
497
- if (result) return this.respond(res, result);
497
+ if (result) {
498
+ if (result._handled) return;
499
+ return this.respond(res, result);
500
+ }
498
501
  return this.respond(res, {
499
502
  statusCode: 404,
500
503
  body: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MikroServe
3
- } from "./chunk-BUKLE4JV.mjs";
3
+ } from "./chunk-E3RGQ7QF.mjs";
4
4
  import "./chunk-ZFBBESGU.mjs";
5
5
  import "./chunk-KJT4SET2.mjs";
6
6
  import "./chunk-NSHBEU32.mjs";
@@ -201,7 +201,10 @@ var MikroServe = class {
201
201
  });
202
202
  }
203
203
  const result = await this.router.handle(req, res);
204
- if (result) return this.respond(res, result);
204
+ if (result) {
205
+ if (result._handled) return;
206
+ return this.respond(res, result);
207
+ }
205
208
  return this.respond(res, {
206
209
  statusCode: 404,
207
210
  body: {
package/lib/index.js CHANGED
@@ -496,7 +496,10 @@ var MikroServe = class {
496
496
  });
497
497
  }
498
498
  const result = await this.router.handle(req, res);
499
- if (result) return this.respond(res, result);
499
+ if (result) {
500
+ if (result._handled) return;
501
+ return this.respond(res, result);
502
+ }
500
503
  return this.respond(res, {
501
504
  statusCode: 404,
502
505
  body: {
package/lib/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MikroServe
3
- } from "./chunk-BUKLE4JV.mjs";
3
+ } from "./chunk-E3RGQ7QF.mjs";
4
4
  import "./chunk-ZFBBESGU.mjs";
5
5
  import "./chunk-KJT4SET2.mjs";
6
6
  import "./chunk-NSHBEU32.mjs";
@@ -98,6 +98,7 @@ interface HandlerResponse {
98
98
  statusCode: number;
99
99
  body: any;
100
100
  headers?: Record<string, string>;
101
+ _handled?: boolean;
101
102
  }
102
103
  /**
103
104
  * @description Route handler function signature.
@@ -98,6 +98,7 @@ interface HandlerResponse {
98
98
  statusCode: number;
99
99
  body: any;
100
100
  headers?: Record<string, string>;
101
+ _handled?: boolean;
101
102
  }
102
103
  /**
103
104
  * @description Route handler function signature.
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "mikroserve",
3
3
  "description": "Minimalistic, ready-to-use API, built on Node.js primitives.",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "author": "Mikael Vesavuori",
6
6
  "license": "MIT",
7
- "keywords": [],
7
+ "keywords": [
8
+ "node",
9
+ "node-server",
10
+ "api",
11
+ "api-server",
12
+ "https"
13
+ ],
8
14
  "main": "lib/index.js",
9
15
  "repository": {
10
16
  "type": "git",
@@ -29,7 +35,7 @@
29
35
  "mikroserve": "lib/index.js"
30
36
  },
31
37
  "scripts": {
32
- "start": "npx tsx src/index.ts --force",
38
+ "start": "npx tsx src/index.ts",
33
39
  "test": "npm run test:licenses && npm run test:types && npm run lint && npm run test:unit",
34
40
  "test:types": "npx type-coverage --at-least 85 --strict --ignore-files \"tests/**/*.ts\" --ignore-files \"*.ts\" --ignore-files \"src/application/errors/*.ts\" --ignore-files \"testdata/*.ts\"",
35
41
  "test:licenses": "npx license-compliance --direct --allow 'MIT;ISC;0BSD;BSD-2-Clause;BSD-3-Clause;Apache-2.0;Unlicense;CC0-1.0'",