New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-blox-sdk

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-blox-sdk

Blox Node.js SDK - includes libraries for SHIELD services and Function Blox Configurations

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

node-blox-sdk

Blox Node.js SDK - includes libraries for SHIELD services and Function Blox Configurations

SDK Usage

  • To write a function,
npm install node-blox-sdk -s

Run Handler / Function using run method by importing functions sdk from node-blox-sdk.

import { functions } from "node-blox-sdk";

export blox_name = (req, res) => {

// business logic
}

functions.run(blox_name)
  • SHIELD
npm install node-blox-sdk

Before using shield, app need to be initialized.

Initialze the application using internals SDK

import { internals } from "node-blox-sdk";

internals.initialize({
		clientId:     process.env.CLIENT_ID,
		clientSecret: process.env.CLIENT_SECRET,
	})

Using the methods from shield sdk

import { shield } from "node-blox-sdk";

const SheildExampleHandler = async (req, res, next) => {
  try {
  
    // Get user details using shield
    const userDetails = await shield.getUser(req);

    // Get user uid using shield
    const userUID = await shield.getUID(req);

  } catch (error) {
    // handle the error
  }
};

Run SheildExampleHandler using run method from funciton sdk.

import { functions } from "node-blox-sdk";

functions.run(SheildExampleHandler)

To run a function, There is 2 option

  • Using CLI
blox start blox_name

to start an individual blox.

or

blox start

to start them all.

  • Assigning a port manually using flags.
cd ./examples/functions-example/
node index.js --port=3000 

the above command will run function in port 3000

go to github.com/AppBlox/node-blox-sdk/tree/main/examples/shield-example to see more example.

Read Docs for advanced tooling

FAQs

Package last updated on 31 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts