@lit-pigeon/rest 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/README.md +55 -0
  2. package/package.json +22 -5
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @lit-pigeon/rest
2
+
3
+ Framework-agnostic Node REST adapter for [Lit Pigeon](https://github.com/snxstudio/lit-pigeon) —
4
+ render, parse, validate, and lint `PigeonDocument`s over HTTP. Mount the
5
+ handler in Express/Fastify/Connect, run a stand-alone server, or launch the
6
+ bundled `lit-pigeon-rest` CLI.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @lit-pigeon/rest
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ Stand-alone Node server:
17
+
18
+ ```ts
19
+ import { createServer } from '@lit-pigeon/rest';
20
+
21
+ const { server, ready } = createServer({ port: 3000 });
22
+ const { host, port } = await ready;
23
+ console.log(`listening on http://${host}:${port}`);
24
+ ```
25
+
26
+ Or mount into an existing framework via a `(req, res)` handler:
27
+
28
+ ```ts
29
+ import { createHandler } from '@lit-pigeon/rest';
30
+
31
+ const handler = createHandler({ bearerToken: process.env.API_TOKEN });
32
+ // e.g. Node http.createServer(handler), or wire into Express/Connect.
33
+ ```
34
+
35
+ ### CLI
36
+
37
+ ```bash
38
+ npx lit-pigeon-rest # honours PORT / HOST / LIT_PIGEON_REST_TOKEN
39
+ ```
40
+
41
+ ### Endpoints
42
+
43
+ `GET /health`, plus POST `/render`, `/render/mjml`, `/validate`, `/parse`,
44
+ `/lint`, and `/lint/async`. Each POST takes `{ document, options? }` JSON. A
45
+ lower-level pure router, `handleRequest(jsonRequest, ctx)`, is also exported for
46
+ custom transports.
47
+
48
+ Rendering, parsing, and linting are powered by [`@lit-pigeon/ssr`](../ssr) and
49
+ [`@lit-pigeon/lint`](../lint).
50
+
51
+ Part of [Lit Pigeon](https://github.com/snxstudio/lit-pigeon) — open-source drag-and-drop email editor.
52
+
53
+ ## License
54
+
55
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lit-pigeon/rest",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Framework-agnostic Node REST adapter for Lit Pigeon — render, parse, and validate documents over HTTP.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,12 +16,14 @@
16
16
  }
17
17
  },
18
18
  "files": [
19
- "dist"
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE"
20
22
  ],
21
23
  "dependencies": {
22
- "@lit-pigeon/core": "^0.2.0",
23
- "@lit-pigeon/lint": "^0.1.3",
24
- "@lit-pigeon/ssr": "^0.1.3"
24
+ "@lit-pigeon/core": "^0.3.1",
25
+ "@lit-pigeon/ssr": "^0.1.5",
26
+ "@lit-pigeon/lint": "^0.1.5"
25
27
  },
26
28
  "peerDependencies": {},
27
29
  "devDependencies": {
@@ -38,6 +40,21 @@
38
40
  "directory": "packages/rest"
39
41
  },
40
42
  "license": "MIT",
43
+ "homepage": "https://github.com/snxstudio/lit-pigeon/tree/main/packages/rest#readme",
44
+ "bugs": "https://github.com/snxstudio/lit-pigeon/issues",
45
+ "author": "Lit Pigeon Contributors",
46
+ "keywords": [
47
+ "email",
48
+ "email-template",
49
+ "email-editor",
50
+ "mjml",
51
+ "html-email",
52
+ "lit",
53
+ "web-components",
54
+ "rest",
55
+ "api",
56
+ "headless"
57
+ ],
41
58
  "scripts": {
42
59
  "build": "tsc",
43
60
  "dev": "tsc -w",