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
JSight Server is the core backend application of the JSight ecosystem providing the JSight
Server API through which any client application can perform
various tasks related to processing the JSight API language.
For more information on configuring the JSight Server, see the
Configuration.
⚠️SUPPORT: If you have any problems while launching the JSight Server, do not hesitate
to contact our support, we respond quickly:
Email: [email protected]
Telegram: https://t.me/jsight_support
For more information on configuring the JSight Server, see the
Configuration.
⚠️SUPPORT: If you have any problems while launching the JSight Server, do not hesitate
to contact our support, we respond quickly:
Email: [email protected]
Telegram: https://t.me/jsight_support
📜 JSight API language
The JSight API language allows you to specify REST and JSON-RPC APIs with incredible speed and
convenience. More information can be found in the Quick
Tutorial or in the language
specification. Here we give examples of the same API
described using JSight API and OpenAPI.
Pay attention to the main feature of the JSight API language. The basis for a data schema is an
example of valid data. Additional data requirements are specified in C-like comments. This
approach greatly simplifies the data schema and makes it intuitively clear. Practice shows that such
schema is very simple to create, read and edit.
JSIGHT 0.3
GET /cats // Get all cats.
200
[@cat]
GET /cats/{id} // Get a cat by its id.
200
@cat
TYPE @cat // Type “Cat”.
{
"id" : 123, // ID of the cat.
"name": "Tom" // Name of the cat.
}
Pay attention to how convenient it is to work with user types in JSight API. The type name is simply
inserted where the type should be in the data schema. Everything is the same as in conventional
programming languages.
Details that are not obvious from the example of valid data are provided in small JSON objects in
C-like comments. This approach allows you to write data schemas of any complexity, while keeping
them compact and intuitive.
JSIGHT 0.3
GET /cats // Get all cats.
200 [@cat] // Returns all cats.
POST /cats // Create a cat.
Request @cat
200 @cat // Success.
GET /cats/{id} // Get a cat by its id.
200 @cat // Returns a cat.
PUT /cats/{id} // Update a cat.
Request @cat
200 @cat // Returns an updated cat.
DELETE /cats/{id} // Delete a cat.
200 any
TYPE @cat // A cat.
{
"id" : 1,
"name" : "Tom",
"color": "black" // {enum: ["black", "white"]}
}
JSIGHT 0.3
GET /cats // Get all cats.
200 [@cat]
PASTE @errorResponses
GET /cats/{id} // Get a cat by its id.
200 @cat
PASTE @errorResponses
TYPE @cat // Type “Cat”.
{
"id" : 1,
"name": "Tom"
}
MACRO @errorResponses
400 any
401 any
405 any
500 any
Macros are a powerful feature of the JSight API language. It allows you to reuse parts of code as
many times as you like.
We did not describe this API in OpenAPI. It is too complicated and very long…
⭐ Star us on GitHub — it motivates us a lot!
JSON-RPC 2.0. New Feature!
Example 9. JSON-RPC 2.0
JSight API 0.3
OpenRPC 1.2.1
JSIGHT 0.3
URL /
Protocol json-rpc-2.0
Method listPets // List all pets
Params
[
20 // Limit (how many items to return).
]
Result
[ // An array of pets
{ // Pet
"id": 123,
"name": "Tom"
}
]
The JSON-RPC API is as simple to describe as the REST API.
You can configure the following application settings:
JSIGHT_SERVER_CORS — If true, the server enables CORS headers, allowing Cross Origin requests
to JSight Server. If false, CORS-headers are not sent, Cross Origin requests to JSight Server
are forbidden.
JSIGHT_SERVER_STATISTICS — If true, then JSight Server will send statistical data to the
statistics collection server. If false, statistics are not sent. ⚠️ Do not turn on this
mode unnecessarily!
Default parameter values:
JSIGHT_SERVER_CORS=false,
JSIGHT_SERVER_STATISTICS=false.
If you need to change the default configuration, set the appropriate environment variables. For
example, JSight Server can be run with the following command:
When starting docker-compose.yml you can specify the following parameters:
HOST_PORT — port at which JSight Server will run.
JSIGHT_SERVER_CORS — If true, the server enables CORS headers, allowing Cross Origin requests
to JSight Server. If false, CORS-headers are not sent, Cross Origin requests to JSight Server
are forbidden.
JSIGHT_SERVER_STATISTICS — If true, then JSight Server will send statistical data to the
statistics collection server. If false, statistics are not sent. ⚠️ Do not turn on this
mode unnecessarily!
Default parameter values:
JSIGHT_SERVER_CORS=false,
JSIGHT_SERVER_STATISTICS=false.
An example of starting JSight Server with the configured parameters:
HOST_PORT=8095 JSIGHT_SERVER_CORS=true JSIGHT_SERVER_STATISTICS=false docker-compose -f docker-compose.yml up -d --build
🔌 JSight Server API
JSight Server provides the JSight Server API at the specified
port (for example, at http://localhost:8080/).
These dependencies are described in the file go.mod.
🧪 Testing
Currently, JSight Server is a very simple application which is why it has no automated tests yet.
However, the libraries used are fully covered by automated tests.
😎 Contributing
Contributing is more than just coding. You can help the project in many ways, and we will be very
happy to accept your contribution to our project.
Details of how you can help the project are described in the CONTRIBUTING.md
document.
Contributors
💬 Bugs and Feature Requests
Do you have a bug report or a feature request?
Please feel free to add a new
issue or write to us in support:
If something is unclear to you, please contact support; we try to respond within 24 hours. Moreover,
it is critical for us to understand what is unclear from the first instance.