This project is being developed for learning purposes, especially in PostgreSQL.
This API has two architectures available, one in REST and the other in JSON RPC, and the RPC version has two ways to be consumed, one over HTTP protocol and the other over TCP protocol.
Currently, it looks like this, but it will probably change over time
Run server:
node --run dev
# or
pnpm run dev
http://localhost:6985/
{
"architecture": {
"REST": {
"API": "http://localhost:6985/api/rest",
"docs": ""
},
"RPC": {
"API": "http://localhost:6985/api/rpc",
"docs": ""
}
}
}
http://localhost:6985/api/rest
Endpoints:
{
"books": "http://localhost:6985/api/rest/books",
"users": "http://localhost:6985/api/rest/users"
}
What is this? you can read the specifications.
The consumption of the JSON RPC
is through the POST
method.
Example:
{
"jsonrpc": "2.0",
"id": 1,
"method": "books",
"params": {
"limit": null,
"page": null
}
}
Result:
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"total": 6,
"results": [
{...}
]
}
]
}
One way to connect to the TCP server is by using Ncat.
Run server:
node --run tcp:dev
# or
pnpm run tcp:dev
Example:
# Windows PowerShell
ncat 127.0.0.1 4040
{"jsonrpc": "2.0", "id": 1, "method": "books", "params": { "limit": null, "page": null }}