@tsonic/express 10.0.18 → 10.0.20
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 +33 -9
- package/index/bindings.json +2812 -10532
- package/index/internal/index.d.ts +1 -389
- package/package.json +3 -3
- package/tsonic.bindings.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
# @tsonic/express
|
|
2
2
|
|
|
3
|
-
Express-style HTTP server APIs for **Tsonic
|
|
3
|
+
Express-style HTTP server APIs for **Tsonic**.
|
|
4
|
+
|
|
5
|
+
This package is part of Tsonic: https://tsonic.org.
|
|
4
6
|
|
|
5
7
|
Use this package to write Express-like apps in TypeScript and compile them to native binaries with `tsonic`.
|
|
6
8
|
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Install the .NET 10 SDK (required by Tsonic): https://dotnet.microsoft.com/download
|
|
12
|
+
- Verify: `dotnet --version`
|
|
13
|
+
|
|
7
14
|
## Quick Start (new project)
|
|
8
15
|
|
|
9
16
|
```bash
|
|
10
17
|
mkdir my-api && cd my-api
|
|
11
|
-
tsonic init
|
|
18
|
+
npx --yes tsonic@latest init
|
|
19
|
+
|
|
20
|
+
# Install Express runtime + bindings (installs required ASP.NET Core deps too)
|
|
21
|
+
npx --yes tsonic@latest add npm @tsonic/express
|
|
22
|
+
|
|
23
|
+
# Replace the default App.ts with a minimal API
|
|
24
|
+
cat > packages/my-api/src/App.ts <<'EOF'
|
|
25
|
+
import { express } from "@tsonic/express/index.js";
|
|
26
|
+
|
|
27
|
+
export function main(): void {
|
|
28
|
+
const app = express.create();
|
|
29
|
+
|
|
30
|
+
app.get("/", (_req, res) => {
|
|
31
|
+
res.json({ ok: true });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
app.listen(3000);
|
|
35
|
+
}
|
|
36
|
+
EOF
|
|
12
37
|
|
|
13
|
-
# Install Express runtime + bindings (and required ASP.NET Core deps)
|
|
14
|
-
tsonic add npm @tsonic/express
|
|
15
38
|
npm run dev
|
|
16
39
|
```
|
|
17
40
|
|
|
@@ -71,7 +94,7 @@ Error middleware:
|
|
|
71
94
|
|
|
72
95
|
```ts
|
|
73
96
|
app.use((err, _req, res, _next) => {
|
|
74
|
-
res.status(500).json({ error:
|
|
97
|
+
res.status(500).json({ error: `${err}` });
|
|
75
98
|
});
|
|
76
99
|
```
|
|
77
100
|
|
|
@@ -116,14 +139,15 @@ server.close();
|
|
|
116
139
|
|
|
117
140
|
## Advanced docs
|
|
118
141
|
|
|
119
|
-
-
|
|
120
|
-
-
|
|
142
|
+
- [docs/advanced.md](docs/advanced.md) (routers, handlers, middleware patterns)
|
|
143
|
+
- [docs/deviations.md](docs/deviations.md) (known compatibility gaps / parity notes)
|
|
144
|
+
- [docs/generation.md](docs/generation.md) (how this package is generated)
|
|
121
145
|
|
|
122
146
|
## Versioning Model
|
|
123
147
|
|
|
124
|
-
This repo is versioned by
|
|
148
|
+
This repo is versioned by runtime major:
|
|
125
149
|
|
|
126
|
-
-
|
|
150
|
+
- `10` -> `versions/10/` -> npm `@tsonic/express@10.x`
|
|
127
151
|
|
|
128
152
|
## License
|
|
129
153
|
|