Building the backend

Let's first build the backend of the app. First of all, run npm install inside the Initial directory to install the required dependencies for our backend.

Here is the backend code to run an express service and serve the index.html file and static files:

var express = require("express");   var app = express();   app.use(express.static("public")); app.get("/", function(req, res){  res.sendFile(__dirname + "/public/html/index.html"); }) app.listen(8080); 

The preceding code is self-explanatory. Now let's proceed further. Our app will have two buttons, that is, Compile and Deploy. When the user clicks on the compile button, the contract will be compiled and when the deploy button is clicked on, the contract will be deployed. ...

Get Blockchain Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.