TypeScript/JavaScript SDK
Overview
The generated Neurelo TypeScript/JavaScript SDK provides easy access to your Neurelo APIs for your applications.
Neurelo TS/JS SDK
This generator creates a TypeScript/JavaScript client that utilizes axios. The generated Node-Module can be used in the following environments:
Environment
Node.js
Webpack
Browserify
Language target
ES5+
Module system
CommonJS
ES2020
The definition should be automatically resolved via package.json
at the time of installation, so you don't have to add axios
in your package dependencies, if you don't want to pass a custom axios instance.
Prerequisites
Download your generated SDK from the API page of your project & move the generated SDK file
neurelo-sdk-typescript-cmt_<id>.tgz
to your project root.Tools for configuring environment variables (e.g. dotenv) or simply export before starting your dev server (inline).
Installation
Commit the
.tgz
file along with the package.json and package-lock.json changesInstall the SDK using npm or yarn:
NPM
npm i ./neurelo-sdk-typescript-cmt_<id>.tgz
YARN
yarn add ./neurelo-sdk-typescript-cmt_<id>.tgz
Modifications
Modifying API configuration
To modify the
Api Key
, you can edit the environment variable :NEURELO_API_KEY
To modify the
Base Path
, you can edit the environment variable :NEURELO_API_BASE_PATH
This sdk package will read environment variables from the
process.env
object. You can use dotenv to load environment variables from.env
file or refer to the respective framework documentation for setting environment variables.Inline variables can be set before starting your development server.
Note - Neurelo SDK package is not responsible for reading environment variables from .env
file. You need to handle it in your project.
Interceptors for axios (Request and Response)
To modify axios config, you can create a
neurelo.config.ts
orneurelo.config.js
file in your project's root directoryConfiguration file should export
AxiosInstance
usingcustomAxios
variable. If you don't exportAxiosInstance
, the packaged SDK will use an internal version ofaxios
Note: Neurelo SDK will be using an internal version of axios if you don't install it or don't export AxiosInstance
using customAxios
variable.
Here is an example:
Getting Started
Using the SDK in your TypeScript/React project:
To see a full example application built with next.js | express | cra
, please visit Neurelo SDK Example 🔗
Last updated