My code is the following;
import express from "express";
const app = express();
const port = 3000;
app.listen(port, () =>{
console.log(`Server is running on ${port}.`)
});
I don’t understand what the issue is here. I’m following a course and followed the suggested steps yet I don’t really know how to fix this.
node index.js
^^^^^
Uncaught SyntaxError: Unexpected identifier ‘index’
I thought it was a syntax error in the code but I can’t find anything. Error makes it sounds like it doesn’t like the name ‘index’ which I thought was funny.
I ran npm install express, then node, node index.js. Nothing super complex, is it possible the course is outdated and some syntax here is no longer valid? (Relatively new to coding, mainly in javascript!)
Mal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.