Closed terrorgeek closed 5 years ago
Hey @painforever!
You can grab your application's state and create transactions from another Node process like this:
let { connect } = require('lotion')
async function main(){
let { state, send } = await connect(GCI)
// query state, this is what would have been at http:// localhost:3000/state before
console.log(await state)
// create tx (previously POST http://localhost:3000/txs)
console.log(await send({ foo: 'bar' }))
}
main()
Hi, I know the recent change has moved 'listen' to 'start', but I wonder how do I make curl calls through HTTP to do all the operations? Thanks a lot.
let lotion = require('lotion'); let app = lotion({ initialState: { count: 0 } });
function transactionHandler(state, transaction) { if (state.count === transaction.nonce) { state.count++ } }
app.use(transactionHandler); console.log("Application started...."); app.start(3000).then(appInfo => { console.log(appInfo.GCI); console.log(appInfo); }); // app.listen(3000);
I'm not sure whether above is correct, but the app did start, however, if I go to http://localhost:3000 it said: This site can’t be reached