express.js code runs on local machine but not on aws-cloud9 IDE preview
I am new to express.js and AWS-cloud9 IDE, both. I am trying to run following code on AWS-cloud9 IDE. I get proper output on terminal, but no/error output on the preview browser.
const express = require('express');
const data = require('./data/data.json');
const app = express();
const PORT = 3000;
app.get('/', (req, res) => {
res.send(`a GET response for / on port ${PORT}.`);
});
app.listen(3000, () => {
console.log(`server started on port ${PORT}`);
//console.log(data);
});
Expected output:
a GET response for / on port 3000.
Actual output:
Cannot GET /vfs/c6f5fa76bfff441c9dbcaa02d4c81a14/previewlocalhost:3000/