Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ES6 Express Server
import express from "express"
var app = express();
app.get("/", (req, res) => {
res.json({hello: 'world'});
});
var port = process.env.PORT || 3000;
var server = app.listen(port, () => {
console.log('Service started on port :' + port);
});
{
"name": "es6-express-server",
"version": "1.0.0",
"scripts": {
"start": "./node_modules/.bin/babel-node main.es6"
},
"babel": {
"presets": [
"es2015"
]
},
"dependencies": {
"babel-cli": "^6.3.15",
"babel-preset-es2015": "^6.3.13",
"express": "^4.13.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment