npgsqlrest 3.2.7 → 3.3.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/package.json +1 -1
- package/postinstall.js +1 -1
- package/readme.md +136 -284
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -6,7 +6,7 @@ const os = require("os");
|
|
|
6
6
|
const https = require("https");
|
|
7
7
|
|
|
8
8
|
const downloadDir = "../.bin/";
|
|
9
|
-
const downloadFrom = "https://github.com/NpgsqlRest/NpgsqlRest/releases/download/v3.
|
|
9
|
+
const downloadFrom = "https://github.com/NpgsqlRest/NpgsqlRest/releases/download/v3.3.1/";
|
|
10
10
|
|
|
11
11
|
function download(url, to, done) {
|
|
12
12
|
https.get(url, (response) => {
|
package/readme.md
CHANGED
|
@@ -1,110 +1,26 @@
|
|
|
1
1
|
# NpgsqlRest
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-
](https://www.npmjs.com/package/npgsqlrest)
|
|
4
|
+
[](https://github.com/NpgsqlRest/NpgsqlRest/actions/workflows/build-test-publish.yml)
|
|
5
5
|

|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Endpoints & Configuration
|
|
26
|
-
- **Instant API Generation**. Automatically creates REST endpoints from PostgreSQL functions, procedures, tables, and views.
|
|
27
|
-
- **Minimal Configuration**. Works out-of-the-box with any PostgreSQL database with minimal configuration file. You only need connection info to get started.
|
|
28
|
-
- **Comment Annotations**. Control and configure endpoint behavior from your database using **declarative comment annotations system.**
|
|
29
|
-
- **Declarative Configuration**. Declare to database how your endpoint should behave. Focus on end-results of your system, not on how it will be implemented.
|
|
30
|
-
- **HTTP Customization**. Set methods, paths, content types, and response headers directly in your database declarations.
|
|
31
|
-
- **Authentication Control**. Configure authorization, roles, and security per endpoint in your database declarations.
|
|
32
|
-
- **Real-Time Streaming**. Enable server-sent events and fine control event scoping (user, roles, etc.) directly in your database declarations.
|
|
33
|
-
- **Response Formatting**. Control output formats, caching, timeouts, and raw responses in your database declarations, and more.
|
|
34
|
-
|
|
35
|
-
### Code Generation
|
|
36
|
-
- **JavaScript**. Generate automatically fetch modules for all endpoints in development mode. Slash development time dramatically and reduce bugs.
|
|
37
|
-
- **TypeScript**. Generate type-safe interfaces and types for generated fetch modules. Bring static type checking for your PostgreSQL database.
|
|
38
|
-
- **HTTP Files**. Auto-generated REST client files, for all generated endpoints, for testing, development and auto-discovery.
|
|
39
|
-
|
|
40
|
-
### Authentication & Security
|
|
41
|
-
- **Multiple Auth Methods**. Cookie authentication, Bearer tokens, and external OAuth providers.
|
|
42
|
-
- **Encrypted Tokens**. Encrypted security tokens with advanced encryption key management and storage options (file, database, etc.).
|
|
43
|
-
- **CORS Support**. Cross-origin resource sharing configuration for Bearer token access.
|
|
44
|
-
- **Built-in Password Validation**. Built-in extendable and secure password hashing and validation. PBKDF2-SHA256 with 600,000 iterations aligned with OWASP's 2023+ recommendations.
|
|
45
|
-
- **OAuth Integration**. Google, LinkedIn, GitHub, Microsoft and Facebook support built-in.
|
|
46
|
-
- **Claims-based security**. User assertions cached in encrypted security token.
|
|
47
|
-
- **Role-Based Authorization**. Fine-grained access control with PostgreSQL role integration.
|
|
48
|
-
- **Claim or Role Parameter Mapping**. Automatically map user claims or roles to parameters.
|
|
49
|
-
- **Claim or Role Context Mapping**. Automatically map user claims or roles to PostgreSQL connection context.
|
|
50
|
-
- **CSRF Protection**. Antiforgery token support for secure uploads and form submissions.
|
|
51
|
-
- **SSL/TLS**. Full HTTPS support with certificate management.
|
|
52
|
-
- **PostgreSQL Security and Encryption**. Database connection security features courtesy of [Npgsql](https://www.npgsql.org/doc/connection-string-parameters.html#security-and-encryption). Includes SSL, Certificates, Kerberos and more.
|
|
53
|
-
|
|
54
|
-
### Performance & Scalability
|
|
55
|
-
- **High Performance**. Blazing fast native executable. See [Performance Benchmarks](https://github.com/NpgsqlRest/pg_function_load_tests).
|
|
56
|
-
- **Connection Pooling**. Built-in connection pooler, courtesy of [Npgsql](https://www.npgsql.org/doc/connection-string-parameters.html#pooling).
|
|
57
|
-
- **KeepAlive, Auto-prepare, Buffer Size**. Other performance tweaks and settings courtesy of [Npgsql](https://www.npgsql.org/doc/connection-string-parameters.html#performance).
|
|
58
|
-
- **Failover, Load Balancing**. Set multiple hosts in connection string for failover and balancing.
|
|
59
|
-
- **Multiple Connections**. Define multiple connections and set specific connections (read-only, write-only) per endpoint in your database declarations.
|
|
60
|
-
- **Connection Retry**. Robust and configurable built-in connection retry mechanism.
|
|
61
|
-
- **Thread Pool Optimization**. Configurable thread pool settings for maximum throughput.
|
|
62
|
-
- **Request Optimization**. Kestrel server tuning with configurable limits.
|
|
63
|
-
- **Response Compression**. Brotli and Gzip compression with configurable levels.
|
|
64
|
-
- **HTTP Caching**. Define endpoint caching per endpoint in your database declarations.
|
|
65
|
-
- **Server Caching**. Define endpoint in-memory server caching per endpoint in your database declarations.
|
|
66
|
-
|
|
67
|
-
### Real-Time & Streaming
|
|
68
|
-
- **Server-Sent Events**. Innovative real-time streaming with PostgreSQL `RAISE INFO` statements. No database locking.
|
|
69
|
-
- **Live Notifications**. Push updates to clients in real-time.
|
|
70
|
-
- **Event Sources**. Auto-generated client code for streaming connections.
|
|
71
|
-
- **Custom Scopes**. Define Server-Sent Event Scope (specific user, groups of users or roles, etc.) per endpoint or per event in your database declarations.
|
|
72
|
-
|
|
73
|
-
### Enterprise Features
|
|
74
|
-
- **Native Executables**. Native executable builds, including ARM versions, have zero dependencies and extremely fast startup times.
|
|
75
|
-
- **Containerization**. Docker-ready hub images.
|
|
76
|
-
- **NPM Package**. Additional distribution channel as NPM package.
|
|
77
|
-
- **Environment Configuration**. Flexible environment variable and configuration management.
|
|
78
|
-
- **Data Protection**. Advanced encryption key management and storage options.
|
|
79
|
-
- **Structured Logging**. Industry standard Serilog logger for Console, rolling file or PostgreSQL database logging.
|
|
80
|
-
- **Excel Processing**. Upload handler for Excel files that supports Excel content processing.
|
|
81
|
-
|
|
82
|
-
### Additional Features
|
|
83
|
-
- **Upload Handlers**. Multiple upload handlers implemented: File System, Large Objects, CSV/Excel, etc., with code generation. Make complex upload and processing pipelines in minutes.
|
|
84
|
-
- **Static Files**. Built-in serving of static content with high speed template parser for user claims and authorization features.
|
|
85
|
-
- **Request Tracking**. Detailed request analytics and connection monitoring.
|
|
86
|
-
- **Performance Metrics**. Built-in performance monitoring and diagnostics.
|
|
87
|
-
- **Error Handling**. Advanced PostgreSQL error code mapping to HTTP status codes.
|
|
88
|
-
- **Custom Headers**. Configurable request/response header management in your database declarations.
|
|
89
|
-
- **IP Tracking**. Client IP address parameter or PostgreSQL connection context for tracking.
|
|
90
|
-
- **.NET Library Integration**. Version with core features implemented as .NET Nuget library for .NET project integration.
|
|
91
|
-
|
|
92
|
-
And more!
|
|
93
|
-
|
|
94
|
-
## Get Started in Seconds
|
|
95
|
-
|
|
96
|
-
Starting is easy:
|
|
97
|
-
|
|
98
|
-
1. **Annotate some PostgreSQL Functions** to enable HTTP Endpoint.
|
|
99
|
-
2. **Prepare Server Executable** (download, install or pull).
|
|
100
|
-
3. **Configure** your PostgreSQL connection in `appsettings.json`
|
|
101
|
-
4. **Run** the executable - your REST API server is live!
|
|
102
|
-
|
|
103
|
-
## Complete Example
|
|
104
|
-
|
|
105
|
-
### 1) Annotate PostgreSQL Function
|
|
106
|
-
|
|
107
|
-
Let's create a simple Hello World function and add a simple comment annotation:
|
|
6
|
+
|
|
7
|
+
**Automatic REST API Server for PostgreSQL**
|
|
8
|
+
|
|
9
|
+
Transform your PostgreSQL database into a production-ready REST API server with automatic TypeScript code generation and end-to-end type safety.
|
|
10
|
+
|
|
11
|
+
**[Documentation](https://npgsqlrest.github.io/)** | **[Getting Started](https://npgsqlrest.github.io/getting-started/)** | **[Configuration](https://npgsqlrest.github.io/config-reference/)** | **[Annotations](https://npgsqlrest.github.io/comment-annotations/)**
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install npgsqlrest
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This downloads the appropriate native executable for your platform (Windows, macOS, or Linux).
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
1. **Create a PostgreSQL function with annotation:**
|
|
108
24
|
|
|
109
25
|
```sql
|
|
110
26
|
create function hello_world()
|
|
@@ -114,251 +30,187 @@ as $$
|
|
|
114
30
|
select 'Hello World'
|
|
115
31
|
$$;
|
|
116
32
|
|
|
117
|
-
comment on function hello_world() is '
|
|
118
|
-
HTTP GET /hello
|
|
119
|
-
authorize admin
|
|
120
|
-
';
|
|
33
|
+
comment on function hello_world() is 'HTTP GET /hello';
|
|
121
34
|
```
|
|
122
35
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
We could also add any HTTP response header, like for example `Content-Type: text/plain`, but since this function returns text, the response will be `text/plain` anyhow.
|
|
126
|
-
|
|
127
|
-
Note: Anything that is not a valid HTTP header or a comment annotation that alters behavior will be ignored and treated as a function comment.
|
|
36
|
+
2. **Create configuration file** (`appsettings.json`):
|
|
128
37
|
|
|
129
|
-
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"ConnectionStrings": {
|
|
41
|
+
"Default": "Host=localhost;Port=5432;Database=mydb;Username=postgres;Password=postgres"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
130
45
|
|
|
131
|
-
|
|
46
|
+
3. **Run the server:**
|
|
132
47
|
|
|
133
|
-
|
|
48
|
+
```bash
|
|
49
|
+
npx npgsqlrest
|
|
50
|
+
```
|
|
134
51
|
|
|
135
|
-
|
|
52
|
+
Your API is now live at `http://localhost:8080/hello`
|
|
136
53
|
|
|
137
|
-
|
|
54
|
+
## Usage
|
|
138
55
|
|
|
139
|
-
|
|
140
|
-
~/dev
|
|
141
|
-
❯ npm i npgsqlrest
|
|
56
|
+
### Run with npx
|
|
142
57
|
|
|
143
|
-
|
|
58
|
+
```bash
|
|
59
|
+
npx npgsqlrest
|
|
144
60
|
```
|
|
145
61
|
|
|
146
|
-
|
|
62
|
+
### Run directly (after install)
|
|
147
63
|
|
|
148
|
-
|
|
64
|
+
```bash
|
|
65
|
+
./node_modules/.bin/npgsqlrest
|
|
66
|
+
```
|
|
149
67
|
|
|
150
|
-
|
|
151
|
-
~/dev
|
|
152
|
-
❯ docker pull vbilopav/npgsqlrest:latest
|
|
153
|
-
latest: Pulling from vbilopav/npgsqlrest
|
|
154
|
-
Digest: sha256:70b4057343457e019657dca303acbed8a1acd5f83075ea996b8e6ea20dac4b48
|
|
155
|
-
Status: Image is up to date for vbilopav/npgsqlrest:latest
|
|
156
|
-
docker.io/vbilopav/npgsqlrest:latest
|
|
68
|
+
### With custom config
|
|
157
69
|
|
|
158
|
-
|
|
70
|
+
```bash
|
|
71
|
+
npx npgsqlrest myconfig.json
|
|
159
72
|
```
|
|
160
73
|
|
|
161
|
-
###
|
|
74
|
+
### Override config via CLI
|
|
162
75
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
~/dev
|
|
167
|
-
❯ cat > appsettings.json << EOF
|
|
168
|
-
{
|
|
169
|
-
"ConnectionStrings": {
|
|
170
|
-
"Default": "Host=localhost;Port=5432;Database=my_db;Username=postgres;Password=postgres"
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
EOF
|
|
76
|
+
```bash
|
|
77
|
+
npx npgsqlrest --urls=http://localhost:3000
|
|
78
|
+
npx npgsqlrest --log:minimallevels:npgsqlrest=debug
|
|
174
79
|
```
|
|
175
80
|
|
|
176
|
-
###
|
|
81
|
+
### Show help
|
|
177
82
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
```console
|
|
181
|
-
~/dev
|
|
182
|
-
❯ ./npgsqlrest
|
|
183
|
-
[11:33:35.440 INF] Started in 00:00:00.0940095, listening on ["http://localhost:8080"], version 2.27.0.0 [NpgsqlRest]
|
|
83
|
+
```bash
|
|
84
|
+
npx npgsqlrest --help
|
|
184
85
|
```
|
|
185
86
|
|
|
186
|
-
|
|
87
|
+
### Show version
|
|
187
88
|
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
❯ npx npgsqlrest
|
|
191
|
-
[11:33:35.440 INF] Started in 00:00:00.0940095, listening on ["http://localhost:8080"], version 2.27.0.0 [NpgsqlRest]
|
|
89
|
+
```bash
|
|
90
|
+
npx npgsqlrest --version
|
|
192
91
|
```
|
|
193
92
|
|
|
194
|
-
|
|
93
|
+
## TypeScript Code Generation
|
|
195
94
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
95
|
+
Enable automatic TypeScript client generation:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"ConnectionStrings": {
|
|
100
|
+
"Default": "Host=localhost;Port=5432;Database=mydb;Username=postgres;Password=postgres"
|
|
101
|
+
},
|
|
102
|
+
"NpgsqlRest": {
|
|
103
|
+
"ClientCodeGen": {
|
|
104
|
+
"Enabled": true,
|
|
105
|
+
"FilePath": "./src/api/{0}Api.ts"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
200
109
|
```
|
|
201
110
|
|
|
202
|
-
|
|
111
|
+
On startup, NpgsqlRest generates type-safe fetch functions for all your endpoints:
|
|
203
112
|
|
|
204
|
-
|
|
113
|
+
```typescript
|
|
114
|
+
// Auto-generated
|
|
115
|
+
export async function publicHelloWorld(): Promise<{status: number, response: string}> {
|
|
116
|
+
const response = await fetch(baseUrl + "/hello", { method: "GET" });
|
|
117
|
+
return { status: response.status, response: await response.text() };
|
|
118
|
+
}
|
|
119
|
+
```
|
|
205
120
|
|
|
206
|
-
|
|
121
|
+
## Key Features
|
|
207
122
|
|
|
208
|
-
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
123
|
+
- **Instant API Generation** - REST endpoints from functions, procedures, tables, and views
|
|
124
|
+
- **Declarative Configuration** - Configure endpoints via SQL comment annotations
|
|
125
|
+
- **TypeScript/JavaScript Generation** - Auto-generate frontend code with full type safety
|
|
126
|
+
- **High Performance** - AOT-compiled native executable, [6x faster than PostgREST](https://npgsqlrest.github.io/blog/postgresql-rest-api-benchmark-2025.html)
|
|
127
|
+
- **RESTful Path Parameters** - Routes like `/products/{id}` with URL parameter extraction
|
|
128
|
+
- **Authentication** - Cookie auth, JWT, Bearer tokens, OAuth (Google, GitHub, etc.)
|
|
129
|
+
- **Authorization** - Role-based access control with PostgreSQL integration
|
|
130
|
+
- **Caching** - In-memory, Redis, or HybridCache with stampede protection
|
|
131
|
+
- **Rate Limiting** - Built-in rate limiter with multiple policies
|
|
132
|
+
- **Server-Sent Events** - Real-time streaming via PostgreSQL RAISE INFO
|
|
133
|
+
- **Reverse Proxy** - Forward requests to upstream services
|
|
134
|
+
- **OpenAPI 3.0** - Auto-generated API documentation
|
|
211
135
|
|
|
212
|
-
|
|
136
|
+
## Configuration Example
|
|
213
137
|
|
|
214
138
|
```json
|
|
215
139
|
{
|
|
216
140
|
"ConnectionStrings": {
|
|
217
|
-
"Default": "Host=localhost;Port=5432;Database=
|
|
141
|
+
"Default": "Host=localhost;Port=5432;Database=mydb;Username=postgres;Password=postgres"
|
|
218
142
|
},
|
|
143
|
+
"Urls": "http://localhost:8080",
|
|
219
144
|
"Log": {
|
|
220
145
|
"MinimalLevels": {
|
|
221
146
|
"NpgsqlRest": "Debug"
|
|
222
147
|
}
|
|
223
148
|
},
|
|
149
|
+
"Auth": {
|
|
150
|
+
"CookieAuth": true
|
|
151
|
+
},
|
|
224
152
|
"NpgsqlRest": {
|
|
225
|
-
"
|
|
153
|
+
"ClientCodeGen": {
|
|
226
154
|
"Enabled": true,
|
|
227
|
-
"
|
|
155
|
+
"FilePath": "./src/api/{0}Api.ts"
|
|
228
156
|
},
|
|
229
|
-
"
|
|
157
|
+
"HttpFileOptions": {
|
|
230
158
|
"Enabled": true,
|
|
231
|
-
"
|
|
159
|
+
"NamePattern": "./http/{0}_{1}.http"
|
|
232
160
|
}
|
|
233
161
|
}
|
|
234
162
|
}
|
|
235
163
|
```
|
|
236
164
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```console
|
|
240
|
-
~/dev
|
|
241
|
-
❯ ./npgsqlrest
|
|
242
|
-
[12:46:05.120 DBG] ----> Starting with configuration(s): JsonConfigurationProvider for 'appsettings.json' (Optional), JsonConfigurationProvider for 'appsettings.Development.json' (Optional), CommandLineConfigurationProvider [NpgsqlRest]
|
|
243
|
-
[12:46:05.135 DBG] Using main connection string: Host=127.0.0.1;Database=my_db;Username=postgres;Password=******;Application Name=dev;Enlist=False;No Reset On Close=True [NpgsqlRest]
|
|
244
|
-
[12:46:05.149 DBG] Attempting to open PostgreSQL connection (attempt 1/7) [NpgsqlRest]
|
|
245
|
-
[12:46:05.194 DBG] Successfully opened PostgreSQL connection on attempt 1 [NpgsqlRest]
|
|
246
|
-
[12:46:05.199 DBG] Using Data Protection for application dev with default provider. Expiration in 90 days. [NpgsqlRest]
|
|
247
|
-
[12:46:05.214 DBG] Using RoutineSource PostgreSQL Source [NpgsqlRest]
|
|
248
|
-
[12:46:05.215 DBG] Using CrudSource PostgreSQL Source [NpgsqlRest]
|
|
249
|
-
[12:46:05.309 DBG] Function public.hello_world mapped to POST /api/hello-world has set HTTP by the comment annotation to GET /hello [NpgsqlRest]
|
|
250
|
-
[12:46:05.311 DBG] Created endpoint GET /hello [NpgsqlRest]
|
|
251
|
-
[12:46:05.332 DBG] Created HTTP file: ./src/http/todo_public.http [NpgsqlRest.HttpFiles]
|
|
252
|
-
[12:46:05.340 DBG] Created Typescript type file: ./src/app/api/publicApiTypes.d.ts [NpgsqlRest.TsClient]
|
|
253
|
-
[12:46:05.340 DBG] Created Typescript file: ./src/app/api/publicApi.ts [NpgsqlRest.TsClient]
|
|
254
|
-
[12:46:05.358 INF] Started in 00:00:00.2759846, listening on ["http://localhost:8080"], version 2.27.0.0 [NpgsqlRest]
|
|
255
|
-
```
|
|
165
|
+
For complete configuration options, see [Configuration Reference](https://npgsqlrest.github.io/config-reference/).
|
|
256
166
|
|
|
257
|
-
|
|
167
|
+
## Comment Annotations
|
|
258
168
|
|
|
259
|
-
|
|
169
|
+
Control endpoint behavior directly in SQL:
|
|
260
170
|
|
|
261
|
-
|
|
171
|
+
```sql
|
|
172
|
+
comment on function my_func() is '
|
|
173
|
+
HTTP GET /api/resource/{id}
|
|
174
|
+
@authorize admin, user
|
|
175
|
+
@cached
|
|
176
|
+
@timeout 30s
|
|
177
|
+
Content-Type: application/json
|
|
178
|
+
';
|
|
179
|
+
```
|
|
262
180
|
|
|
263
|
-
|
|
264
|
-
@host=http://localhost:8080
|
|
181
|
+
See [Annotation Guide](https://npgsqlrest.github.io/comment-annotations/) for all available annotations.
|
|
265
182
|
|
|
266
|
-
|
|
267
|
-
// returns text
|
|
268
|
-
//
|
|
269
|
-
// comment on function public.hello_world is 'HTTP GET /hello
|
|
270
|
-
// authorize admin';
|
|
271
|
-
GET {{host}}/hello
|
|
183
|
+
## Supported Platforms
|
|
272
184
|
|
|
273
|
-
|
|
274
|
-
```
|
|
185
|
+
The npm package includes native executables for:
|
|
275
186
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
```ts
|
|
281
|
-
// autogenerated at 2025-08-17T11:06:58.6605710+02:00
|
|
282
|
-
const baseUrl = "http://localhost:8080";
|
|
283
|
-
|
|
284
|
-
export const publicHelloWorldUrl = () => baseUrl + "/hello";
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* function public.hello_world()
|
|
288
|
-
* returns text
|
|
289
|
-
*
|
|
290
|
-
* @remarks
|
|
291
|
-
* comment on function public.hello_world is 'HTTP GET /hello
|
|
292
|
-
* authorize admin';
|
|
293
|
-
*
|
|
294
|
-
* @returns {{status: number, response: string}}
|
|
295
|
-
*
|
|
296
|
-
* @see FUNCTION public.hello_world
|
|
297
|
-
*/
|
|
298
|
-
export async function publicHelloWorld() : Promise<{status: number, response: string}> {
|
|
299
|
-
const response = await fetch(publicHelloWorldUrl(), {
|
|
300
|
-
method: "GET",
|
|
301
|
-
});
|
|
302
|
-
return {
|
|
303
|
-
status: response.status,
|
|
304
|
-
response: await response.text()
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
```
|
|
308
|
-
For a full list of configuration options, see the [default configuration file](https://github.com/NpgsqlRest/NpgsqlRest/blob/master/NpgsqlRestClient/appsettings.json). Any settings your configuration file will override these defaults.
|
|
187
|
+
- **Windows** - x64
|
|
188
|
+
- **macOS** - x64, ARM64 (Apple Silicon)
|
|
189
|
+
- **Linux** - x64, ARM64
|
|
309
190
|
|
|
310
|
-
|
|
191
|
+
## Alternative Installation Methods
|
|
311
192
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
193
|
+
| Method | Command |
|
|
194
|
+
|--------|---------|
|
|
195
|
+
| **Docker** | `docker pull vbilopav/npgsqlrest:latest` |
|
|
196
|
+
| **Direct Download** | [GitHub Releases](https://github.com/NpgsqlRest/NpgsqlRest/releases) |
|
|
197
|
+
| **.NET Library** | `dotnet add package NpgsqlRest` |
|
|
317
198
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
```console
|
|
321
|
-
~/dev
|
|
322
|
-
❯ ./npgsqlrest --help
|
|
323
|
-
Usage:
|
|
324
|
-
npgsqlrest Run with the optional default configuration files: appsettings.json and appsettings.Development.json. If these file are not found, default configuration setting is used (see
|
|
325
|
-
https://github.com/NpgsqlRest/NpgsqlRest/blob/master/NpgsqlRestClient/appsettings.json).
|
|
326
|
-
npgsqlrest [files...] Run with the custom configuration files. All configuration files are required. Any configuration values will override default values in order of appearance.
|
|
327
|
-
npgsqlrest [file1 -o file2...] Use the -o switch to mark the next configuration file as optional. The first file after the -o switch is optional.
|
|
328
|
-
npgsqlrest [file1 --optional file2...] Use --optional switch to mark the next configuration file as optional. The first file after the --optional switch is optional.
|
|
329
|
-
Note: Values in the later file will override the values in the previous one.
|
|
330
|
-
|
|
331
|
-
npgsqlrest [--key=value] Override the configuration with this key with a new value (case insensitive, use : to separate sections).
|
|
332
|
-
|
|
333
|
-
npgsqlrest -v, --version Show version information.
|
|
334
|
-
npgsqlrest -h, --help Show command line help.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
Examples:
|
|
338
|
-
Example: use two config files npgsqlrest appsettings.json appsettings.Development.json
|
|
339
|
-
Example: second config file optional npgsqlrest appsettings.json -o appsettings.Development.json
|
|
340
|
-
Example: override ApplicationName config npgsqlrest --applicationname=Test
|
|
341
|
-
Example: override Auth:CookieName config npgsqlrest --auth:cookiename=Test
|
|
342
|
-
...
|
|
343
|
-
```
|
|
199
|
+
## Requirements
|
|
344
200
|
|
|
345
|
-
## System Requirements
|
|
346
201
|
- PostgreSQL >= 13
|
|
347
|
-
-
|
|
348
|
-
|
|
349
|
-
## .NET Library Integration
|
|
350
|
-
For integrating into existing .NET applications:
|
|
351
|
-
```console
|
|
352
|
-
dotnet add package NpgsqlRest
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
Note: PostgreSQL 13 minimal version is required to run the initial query to get the list of functions. The source code of this query can be found [here](https://github.com/NpgsqlRest/NpgsqlRest/blob/master/NpgsqlRest/RoutineQuery.cs). For versions prior to version 13, this query can be replaced with a custom query that can run on older versions.
|
|
202
|
+
- Node.js >= 14 (for npm/npx)
|
|
356
203
|
|
|
357
|
-
##
|
|
204
|
+
## Links
|
|
358
205
|
|
|
359
|
-
|
|
360
|
-
|
|
206
|
+
- [Documentation](https://npgsqlrest.github.io/)
|
|
207
|
+
- [Getting Started Guide](https://npgsqlrest.github.io/getting-started/)
|
|
208
|
+
- [Configuration Reference](https://npgsqlrest.github.io/config-reference/)
|
|
209
|
+
- [Comment Annotations](https://npgsqlrest.github.io/comment-annotations/)
|
|
210
|
+
- [GitHub Repository](https://github.com/NpgsqlRest/NpgsqlRest)
|
|
211
|
+
- [Changelog](https://github.com/NpgsqlRest/NpgsqlRest/blob/master/changelog.md)
|
|
212
|
+
- [Docker Hub](https://hub.docker.com/r/vbilopav/npgsqlrest)
|
|
361
213
|
|
|
362
214
|
## License
|
|
363
215
|
|
|
364
|
-
|
|
216
|
+
MIT License - see [LICENSE](https://github.com/NpgsqlRest/NpgsqlRest/blob/master/LICENSE)
|