syl.js
v1.2.0
Published
Create and utilize new forms of APIs.
Downloads
18
Readme
Getting Started with Syl
Installing syl.js
:
- Open a new Terminal or Command Prompt.
- Enter the following command:
npm i syl.js
Notice
As of [email protected]
, only the WebSyl
supports previous versions.
If you are using the PublicSyl
(or just Syl
) or the PrivateSyl
, you will not be able to send data without being on the latest syl.js
version. This is due to API incompatibility errors.
You will still be able to receive data from these two tools from this version and above.
You will not be able to retrieve data while using any version before @1.1.0
.
Changelog
- Fixed importing issues.
- Fixed an issue with the
WebSyl#setRoute()
method for POST requests.
- Added the
PrivateSyl
.
- The
PrivateSyl
class requires a password to use a Syl. If you'd like a Password, please join the Discord Server shown at the bottom of the page and open a ticket.- Modified the
Syl
to require the usage of methods, rather than setting variables.
Syl#setToken()
,PrivateSyl#setToken()
, andPrivateSyl#setPassword()
.
- Updated API Version.
Syl Types
PublicSyl (or just Syl)
- A basic form of API utility that allows you to communicate between two different scripts.
- A Web Server is already set up for all Syl instances, and you can access them through tokens.
- Anyone can modify the data of any token on a PublicSyl. Be careful with this.
PrivateSyl
- A simple modification to the PublicSyl to require a Syl to have a password.
- PrivateSyls are given upon request; not given upon immediate access.
- If you would like access, please join the Discord Server at the bottom of the page and open a ticket.
WebSyl
- A basic form of Web API that allows you to communicate between web servers.
Examples
PublicSyl
Sending data with PublicSyl
const Syl = require("syl.js");
const syl = new Syl();
syl.setToken("example_token");
syl.send("Hello world!");
Receiving data with PublicSyl
const Syl = require("syl.js");
const syl = new Syl();
syl.setToken("example_token");
syl.read((response) => {
console.log(response); // expected output: Hello world!
});
PrivateSyl
Note: You must have a Private Syl Instance set up to use this.
Sending data with PrivateSyl
const { PrivateSyl } = require("syl.js");
const syl = new PrivateSyl();
syl.setToken("example_token");
syl.setPassword("hello_world");
syl.send("hello world");
Receiving data with PrivateSyl
const { PrivateSyl } = require("syl.js");
const syl = new PrivateSyl();
syl.setToken("example_token");
syl.setPassword("hello_world");
syl.read((response) => {
console.log(response); // expected output: hello world
});
WebSyl
Sending data with WebSyl
const { WebSyl, RequestType } = require("syl.js");
const syl = new WebSyl({ port: 80 });
syl.setUpRoute("/", RequestType.GET, { successful: true });
syl.setUpRoute("/data", RequestType.POST, (body, respond) => {
const { string } = body;
console.log(string); // expected output: hello world
respond("Successful!");
// Syl has an automated response of Successful! that can be overridden.
// The respond() method is not necessary in your code.
});
Receiving data with WebSyl
const { WebSyl } = require("syl.js");
const syl = new WebSyl({ domain: "https://yourdomain.com" });
// Instead of providing the "port" parameter, you can provide the "domain" parameter to change the type of WebSyl being used.
syl.get("/", (data) => {});
syl.post("/", { string: "hello world" });
Future Plans
- Introduce the
UPDATE
Request Type.- Introduce the
DELETE
Request Type.- Introduce the
DATA CACHE
for theSyl
andWebSyl
.
Dependencies
[email protected]
- Express allows the
WebSyl
to create a barebones API system.[email protected]
- atils allows us to send out fancy looking errors, log them in your computer, and allows the
RequestTypes
Enum to function.
Need Help?
If you need some assistance with syl.js
, contact me @ [email protected]
.I'll assist you when I can.
Little Notice
syl.js
will be updating to [email protected]
when it releases. I'll have to go through and change a lot of things, but I'd rather use it than not. I still don't have a release date for [email protected]
though.
Getting Your Own PrivateSyl
To get a PrivateSyl, join the Discord Server here, and DM the Setrius Development bot to open a support ticket.
Your Discord username and tag will not be shown to our Support Team, nor will you be able to view the Support Team Member's username and tag.