@nano-app/plugins 0.0.1 → 0.1.1
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 +3 -3
- package/build/health/index.d.ts +2 -2
- package/build/health/index.js +3 -2
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ npm install @nano-app/backend @nano-app/plugins
|
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import { createNanoApp } from "@nano-app/backend";
|
|
11
|
-
import health from "@nano-app/plugins/health";
|
|
11
|
+
import { health } from "@nano-app/plugins/health";
|
|
12
12
|
|
|
13
13
|
createNanoApp({ plugins: [health()] });
|
|
14
14
|
```
|
|
@@ -17,14 +17,14 @@ createNanoApp({ plugins: [health()] });
|
|
|
17
17
|
|
|
18
18
|
| Plugin | Import | Endpoints | Options |
|
|
19
19
|
|---|---|---|---|
|
|
20
|
-
| `health` |
|
|
20
|
+
| `health` | `import { health } from "@nano-app/plugins/health"` | `GET /health` → `{ status: "ok" }` | `basePath` (default `"/health"`) |
|
|
21
21
|
|
|
22
22
|
## Layout
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
plugins/
|
|
26
26
|
└── <name>/
|
|
27
|
-
├── index.ts createPlugin factory
|
|
27
|
+
├── index.ts exports the createPlugin factory as `<name>`: the import path
|
|
28
28
|
└── routes/ *.route.ts, mounted under the plugin's basePath
|
|
29
29
|
```
|
|
30
30
|
|
package/build/health/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _nano_app_backend from '@nano-app/backend';
|
|
2
2
|
|
|
3
3
|
/** Health check: `GET /health` answers `{ status: "ok" }` while the server is up. */
|
|
4
|
-
declare const
|
|
4
|
+
declare const health: (options?: {
|
|
5
5
|
basePath?: string;
|
|
6
6
|
} | undefined) => _nano_app_backend.PluginConfig<{
|
|
7
7
|
basePath?: string;
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
|
-
export {
|
|
10
|
+
export { health };
|
package/build/health/index.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import { createPlugin } from "@nano-app/backend";
|
|
3
3
|
import { dirname, resolve } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
-
var
|
|
5
|
+
var health = createPlugin((options) => ({
|
|
6
6
|
name: "health",
|
|
7
7
|
basePath: options?.basePath ?? "/health",
|
|
8
8
|
stage: "before",
|
|
9
|
+
// Next to this file, from the sources and from the build
|
|
9
10
|
routesDir: resolve(dirname(fileURLToPath(import.meta.url)), "routes")
|
|
10
11
|
}));
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
health
|
|
13
14
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nano-app/plugins",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Official plugins for @nano-app/backend
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Official plugins for @nano-app/backend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./*": {
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"build",
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsup",
|
|
18
|
+
"test": "tsx --env-file-if-exists=../.env --test tests/*.test.ts",
|
|
19
|
+
"prepublishOnly": "pnpm run build"
|
|
20
|
+
},
|
|
16
21
|
"keywords": [
|
|
17
22
|
"nano-app",
|
|
18
23
|
"express",
|
|
@@ -35,15 +40,11 @@
|
|
|
35
40
|
"@nano-app/backend": ">=0.7.1"
|
|
36
41
|
},
|
|
37
42
|
"devDependencies": {
|
|
38
|
-
"@
|
|
43
|
+
"@nano-app/backend": "workspace:*",
|
|
44
|
+
"@types/node": "^26.6.5",
|
|
39
45
|
"glob": "^13.0.6",
|
|
40
46
|
"tsup": "^9.0.0",
|
|
41
47
|
"tsx": "^4.23.15",
|
|
42
|
-
"typescript": "^5.9.3"
|
|
43
|
-
"@nano-app/backend": "0.0.0-semantic-release"
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "tsup",
|
|
47
|
-
"test": "tsx --test tests/*.test.ts"
|
|
48
|
+
"typescript": "^5.9.3"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|