I have a droplet created using the one click install for node.js with Ubuntu 18.04.1 LTS. I cloned my git repository from gitlab, and my end goal is to run my app with forever. For now, everytime I run:

sudo node server.js

an error message appears when I got to my ip address saying:

Cannot GET /

The following is my server.js file:

const express = require('express')
const path = require('path')
const history = require('connect-history-api-fallback')

const app = express()

const staticFileMiddleware = express.static(path.join(__dirname + '/d$

  disableDotRule: true,
  verbose: true

app.get('/', function (req, res) {
  res.render(path.join(__dirname + '/dist/index.html'))

var server = app.listen(process.env.PORT || 80, function () {
  var port = server.address().port
  console.log('App now running on port', port);
  console.log(path.join(__dirname + '/dist/index.html'));

on my local machine that same command works fine and my app works, but on my droplet I am having a lot of problems.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!