micronuron
v0.0.2
Published
> Microservice for interacting with Nuron remotely
Downloads
3
Readme
micronuron
Microservice for interacting with Nuron remotely
Install
Usage
1. Server
const express = require('express')
const Micronuron = require('micronuron')
const app = express()
const miconuron = new Micronuron({
app,
key: "m'/44'/60'/0'/0/0",
workspace: "cube",
domain: {
"address":"0x93f4f1e0dca38dd0d35305d57c601f829ee53b51",
"chainId":4,
"name":"_test_"
},
})
// POST /nuron/token/create
miconuron.token.create((req, res, nuron) => {
// req.body => token payload
})
// POST /nuron/token/build
miconuron.token.build((req, res, nuron) => {
// req.body => token payload
})
// POST /nuron/token/sign
miconuron.token.sign((req, res, nuron) => {
// req.body => token payload
})
// GET /nuron/fs/:cid
micronuron.fs.read((req, res, nuron) => {
// req.params.cid
})
// POST /nuron/fs/binary
// POST /nuron/fs/json
micronuron.fs.write((req, res, nuron) => {
if (req.file) {
// file upload handling
} else if (req.body) {
// json upload handling
}
})
2. Frontend
const nuron = new Nuron({ url: "https://pixel.papercorp.org" })
await nuron.fs.write()
await nuron.token.create()
await nuron.token.build()
await nuron.token.sign()