This is Project 3: RESTful API with Node.js Framework. In this project I created two endpoints to access and add blocks to my private blockchain.
To setup the project for review do the following:
- Download the project.
- Run command npm install to install the project dependencies.
- Run command node simpleChain.js in the root directory to generate a blockchain with test blocks.
- Run command node app.js to start server. Access the server at the following address:
http://localhost:8000/
- Node.js Framework
This project uses Express.js, a fast, unopinionated, minimalist framework for Node.js. More information can be found at:
https://expressjs.com
URL: http://localhost:8000/block/[blockheight]
Example URL path: http://localhost:8000/block/3 -> where '3' is the block height
Response: The response provides a block object of corresponding height in JSON format.
URL: http://localhost:8000/block
Payload:
{
"data": "insert block body data here"
}
Response: The response provides a newly generated block, containing corresponding payload data, in JSON format.