@rxclient/req
v1.0.4
Published
It is a package that allows you to interact with the RXWEB API, offering information on endpoints available to your liking in your project.
Downloads
13
Readme
Information
Mainly created for users who use the RXWEB API and use JavaScript for their projects.
Installation
npm
npm i @rxclient/req
yarn
yarn add @rxclient/req
Usage
const { EndpointGet, data } = require("@rxclient/req");
// With parameters
EndpointGet("utils", "calculator", { operation: "125*123" })
.then(() => {
console.log("The result of the mathematical operation is:", data.utils_calculator.result) // We get the information from the API
})
// No parameters
EndpointGet("text", "funfacts")
.then(() => {
console.log(data.text_funfacts.results)
})
Docs
EndpointGet(category, route, optional: { parameters })
category
: Category where the route is located. (For example:EndpointGet("utils")
)route
: The endpoint route. (For example:EndpointGet("utils", "calculator")
){ parameters }
: Only necessary if parameters are required on the endpoint; the endpoint parameters to make it work. (For example:EndpointGet("utils", "calculator", { operation: "25*25" })
)
data.category_route.(optional):specific_result
category
: Endpoint category. (For example:data.utils
)route
: The endpoint route. (For example:data.utils_calculator
)specific_result
: Returns a specific response based on the JSON; if left empty, it will return all endpoint JSON. (For example:data.utils_calculator.result
)
No specific response
const { EndpointGet, data } = require("@rxclient/req")
EndpointGet("utils", "calculator", { operation: "125*123" })
.then(() => {
console.log(data.utils_calculator)
})
Result
[]
Specific form
const { EndpointGet, data } = require("@rxclient/req")
EndpointGet("utils", "calculator", { operation: "125*123" })
.then(() => {
console.log(data.utils_calculator.result)
})
Result
[]
Tip
Find out which endpoints are available by entering /endpoints.