Sunday, 16 April 2017

Unable to run a simple es6 Nodejs application

I've created a simple nodejs express application:

const express = require("express");
const app = express();
app.set("views", path.join(__dirname, "views"));
app.listen(3000, => (req, res) {
  res.sendFile("index.html") 
})

It throws an exception:

app.listen(3000, => (req, res) {
                 ^^
SyntaxError: Unexpected token =>



via Dorion

No comments:

Post a Comment