1.0.4 • Published 1 year ago

@rxclient/req v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Information

npm version npm downloads license

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

[No specific response]

Specific form

const { EndpointGet, data } = require("@rxclient/req")

EndpointGet("utils", "calculator", { operation: "125*123" })
  .then(() => {
    console.log(data.utils_calculator.result)
  })

Result

[Specific form]

Tip

Find out which endpoints are available by entering /endpoints.

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago