You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Super opinionated, minimalistic, PG centric API fabric
7
+
> SCRUD API server, fast, light, capable
8
8
9
-
# what it is
9
+
# what is SCRUD
10
10
11
-
- a collection of helpers that allow you to stand up APIs rapidly
12
-
- extremely opinionated
13
-
- driven by PostgreSQL functions
14
-
- all APIs revolve around [SCRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) actions
15
-
- all resource actions have default handlers but can be individually overridden
11
+
It's just [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) with a search action included in the package.
12
+
- search
13
+
- create
14
+
- read
15
+
- update
16
+
- delete
17
+
18
+
Every resource has corresponding SCRUD actions which are expressed in the HTTP methods and path (resource ids and query params).
19
+
20
+
# what is this module
21
+
22
+
- a blazing fast API server
23
+
- a resourceful SCRUD based router
24
+
- a collection of tools that allow you to stand up APIs rapidly
25
+
- opinionated
26
+
- full featured (PG, gzip, CORS, and JWT fully integrated)
27
+
- a wire between your SCRUD PostgreSQL functions and the client
16
28
17
29
# who is it for
18
30
19
31
- me mostly
20
-
- organizations / individuals comfortable working with business logic in Postgres
32
+
- folks who need a fast and effective resource driven API server
33
+
- organizations / individuals who like PostgreSQL and need a solid frontend
21
34
22
35
# is it fast
23
36
24
-
Glad you asked. Yes, it is. As always, take benches with a grain of salt. The point is we care about speed and optimize for it. To see benchmarking details check out the bench directory. The gist is this, all libs return a simple JSON response and the proper content-type headers. Each server is run in their own forked process and gets a warm up run for 3 seconds before we start tracking the results.
37
+
Glad you asked. Yes, it is.
38
+
39
+
# benchmarks
40
+
41
+
As always, take benches with a grain of salt. The point is that we care about performance and optimize for it. To see benchmarking details check out the bench directory. The gist is this, all libs return a simple JSON response and the proper content-type headers. Each server is run in their own forked process and gets a warm up run for 3 seconds before we start tracking the results.
42
+
43
+
Node's `http` built-in is given the advantage of pre-rendered JSON, as it is the benchmark. SCRUD and Polka bounce back and forth in second position. To be clear SCRUD only handles resourceful SCRUD routes, Polka packs a more capable router which handles less standardized routes and an Express compatible middleware handler. SCRUD is focused on APIs and microservices.
- should return: `Promise` that resolves with data to be sent to client
125
+
- default: `null`
126
+
-**IMPORTANT:** If a Promise isn't returned or doesn't resolve or reject and the function doesn't close the response it will be hung. Also, the data that is sent in the promise resolution will be passed to the client, be sure it's what you intend to send.
74
127
75
128
### scrud.start(options)
76
129
Set global options and start API server
77
130
78
131
***Returns:*** Promise which with resolves with http.Server
79
132
80
133
***Arguments:***
81
-
-**options***(Object)* - *required*
134
+
-**options**- `Object` - *required*
82
135
-**basePath** - *optional* - base path for APIs (i.e. `https://host.com/${basePath}/resource`)
83
136
- type: `String`
84
137
- default: `null`
@@ -97,6 +150,9 @@ Set global options and start API server
97
150
-**logger** - *optional* - callback that will get called with any errors encountered
0 commit comments