Created
April 13, 2019 15:27
-
-
Save schadokar/5aeb887f21d71a36bbe6effaf0b3b4bd to your computer and use it in GitHub Desktop.
docker-ethereum server of the dapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
const cors = require("cors"); | |
const app = express(); | |
const contractAPIRoutes = require("./routes/contract-API"); | |
const smartContractAPIRoutes = require("./routes/smart-contract-API"); | |
const port = 4000; | |
app.use(cors()); | |
app.use(bodyParser.json()); | |
app.use( | |
bodyParser.urlencoded({ | |
limit:"50mb", | |
extended:false, | |
parameterLimit:50000 | |
}) | |
); | |
// use the routes specified in route folder | |
app.use("/", contractAPIRoutes); | |
app.use("/",smartContractAPIRoutes); | |
app.use(function(err, req,res, next){ | |
res.status(422).send({error: err.message}); | |
}); | |
//listen to the server | |
app.listen( port, function(){ | |
console.log(`Listening to the port ${port} .....`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment