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

bfs-backend-example

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

bfs-backend-example

bits-fusion backend example

latest
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

bfs-backend-example package

This package has been specifically designed and implemented for use in bits-fusion workshops. It is intended to be utilized in a Node.js environment with TypeScript. The package serves as a wrapper for two dependencies, namely serialport and express, and offers straightforward APIs to facilitate rapid development.

Install dependencies

Go to project directory and install dependencies

npm install bfs-backend-example

Examples

Example 1 - Serial Port

/**
 * Example 1 - Serial Port
 * What is your port name?
 * - Windows: Open device manager
 * - Mac: Run `ls /dev/tty.*` in terminal
 */
import { McuSerial } from 'bfs-backend-example';
const PORT_NAME = "COM1"; //!! <-- DEPENDED ON YOUR SYSTEM
new McuSerial(PORT_NAME, {
    onOpen: (link: McuSerial) => {
        link.send("pwmd/3/0.99");
    },
    onData: (data) => {
        console.log(data);
    },
});

Example 2 - Simple Web Server

/**
 * Example 2 - Simple Web Server
 */
import { WebServer } from 'bfs-backend-example';
new WebServer();

Example 3 - Simple Web Server with MCU

/**
 * Example 5 - Simple Web Server with MCU
 * Note:
 *  - Check and set serial port name.
 *  - Goto `http://localhost:3000/mcu` to get MCU message.
 */
import { McuSerial, WebServer } from 'bfs-backend-example';
new WebServer(new McuSerial("COMx"));//!! <-- DEPENDED ON YOUR SYSTEM

FAQs

Package last updated on 14 Jul 2023

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