The C3 SDK for NodeJS
Here's a hello world example:
const c3 = require('c3-sdk-js')
const client = new c3.Client()
class App {
setItem (key, value) {
client.state().set(Buffer.from(key), Buffer.from(value))
}
getItem (key) {
const { value, found } = client.state().get(Buffer.from(key))
if (!found) {
return ''
}
return value.toString()
}
}
function main () {
const app = new App()
client.registerMethod('setItem', ['string', 'string'], app.setItem)
client.registerMethod('getItem', ['string'], app.getItem)
client.serve()
}
main()
make test
Lint
make lint/fix
- Use TypeScript
MIT