2

As it seems lite-server is only good for development. I decided to use server.js for production but I have no idea how to configure it for truffle?

  • The title says "truffle instead of lite-server", the body says "server.js instead of lite-server". And the entire question is missing a lot of context IMO. You might want to elaborate a little further if you're hoping to get an answer. – goodvibration Jul 24 at 11:57
  • @goodvibration you're right. I'll edit it soon. I actually solved the problem and It will be shared here. – Amir Hossein Babaeian Jul 25 at 15:45
2

As I mentioned above, I experienced some problems to use server.js instead of lite-server. The solution is to include folders than I keep the web-application files and the compiled contracts. I created a server.js file and put the following script in it. Then I added

"start": "node server.js"

to the package.json's scripts part.

var connect = require('connect');
var serveStatic = require('serve-static');
connect()
.use(serveStatic('src'))
.use(serveStatic('build/contracts'))
.listen(80, function(){
    console.log('Server running on 80...');
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.