Stratumn agent for NodeJS
This NodeJS module exposes functions to create Stratumn agents using Javascript.
Creating an HTTP server for an agent
var express = ;var agent = ; // Assumes your transition functions are in ./lib/transitions.var transitions = ; // The server is an Express server.var app = ; // Create an HTTP store client to save segments.// Assumes an HTTP store server is available on env.STRATUMN_STORE_URL or http://store:5000.var storeHttpClient = agent; app; // Create an agent HTTP server from the transition functions and the store client.var agentHttpServer = agent; // Mount agent on the root path of the server.app; // Start the server.app;
Advanced usage
httpServer
creates an HTTP server for an agent.storeHttpClient
creates an instance to work with stores via HTTP.agent
creates an instance to work directly with an agent without a server.