Giter Club home page Giter Club logo

cordapp-example-nodejs-server-graalvm's Introduction

cordapp-example-nodejs-server-graalvm

This example demonstates a nodejs server which uses corda rpc-3.1 library running in GraalVM. The nodejs server serves APIs to create IOU, fetch IOUs similar to the cordapp-example

Pre-requisites

Setting Up the GraalVM environment

  • Follow the official GraalVM documentation on how to setup the Graal for linux or osX.
  • To learn more about GraalVM refer to the Mike Hearn's blog

Steps to the run the node.js server with GraalVM

  • Run the cordapp-example nodes
  • Make sure that the nodeConfig.json file matches the settings of a running node
  • Run ./gradlew printClassPath once to make sure everything is downloaded. You should see a big classpath be printed.
  • Run npm install from root directory of the project to install express and body-parser npm modules.
  • Run node --jvm --jvm.cp=$( ./gradlew -q printClasspath ) server.js
  • Output will look like: PartyA Node.js server listening on port 3000

TroubleShooting

If you get the following error when starting the server, you need to install GraalVM:

node: bad option: --jvm
node: bad option: --jvm.cp=

Interacting with the Cordaapp-example network to create IOUs from nodejs server

  1. Create-iou

curl -d '{"iouValue":10, "otherPartyOrgName":"PartyB","otherPartyOrgCountry":"New York", "otherPartyOrgLocality":"US"}' -H "Content-Type: application/json" -X POST http://localhost:3000/api/example/create-iou

  1. Fetch IOUs

curl http://localhost:3000/api/example/ious

Other endpoints

  • GET /api/example/me
  • GET /api/example/peers

cordapp-example-nodejs-server-graalvm's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.