This is a Convector-CLI generated project for Hyperledger Fabric.
It is based on the Fabcar chaincode created in Fabric-samples.
The idea is to showcase how to migrate your mental concepts from Go development to TypeScript based Convector smart contracts.
# Compile everything
npx lerna bootstrap
# Wake yourself up a dev blockchain
npm run env:restart
# Now install the chaincode!
npm run cc:start -- car 1
There is also included a NodeJS backend to make a few REST endpoints available.
# Start the backend
npx lerna run dev:debug --scope myapp --stream
A few API endpoints will be available at http://localhost:300. You can test them out with Postman.
GET localhost:3000/api/v1/examples
GET localhost:3000/api/v1/examples/1
POST localhost:3000/api/v1/examples/
Body
{
"make":"Volkswagen",
"model":"Jetta",
"colour":"gray",
"owner":"Walter Montes",
"id":"1"
}
As simple as the example looks like, getting around all the Go code may be confusing, so we made it even easier with the framework's CLI.
# In case you don't have Convector-CLI installed already
npm i -g @worldsibu/convector-cli
conv new fabcar -c car
cd fabcar
npm i
Modify the default ./packages/car-cc/src/car.model.ts.
and ./packages/car-cc/src/car.controller.ts.
, refer to Run this project section.
A tutorial in Hacker Noon here.
You can find the original Go Fabcar example here as well the original NodeJS non-Convector file. That way you can compare how a Convector file helps you build better code.
This examples is provided under an Apache 2.0 license.