Created
December 11, 2015 00:28
-
-
Save jbgutierrez/a199e793089978d90a00 to your computer and use it in GitHub Desktop.
ES6 Express Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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