Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimal babel boilerplate
{
"presets": [ "es2015" ]
}
const express = require('express');
const app = express();
const port = 3000;
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}!`);
});
{
"dependencies": {
"babel": "^6.5.2",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"express": "^4.13.4"
}
}
require('babel-register');
require('./app');
@bdchauvette

This comment has been minimized.

Show comment
Hide comment
@bdchauvette

bdchauvette Jun 5, 2016

npm install
node start
curl localhost:3000

# -> Hello World!
Owner

bdchauvette commented Jun 5, 2016

npm install
node start
curl localhost:3000

# -> Hello World!
@smoothness

This comment has been minimized.

Show comment
Hide comment
@smoothness

smoothness Jun 10, 2016

Thanks for sharing.

Thanks for sharing.

@just-boris

This comment has been minimized.

Show comment
Hide comment
@just-boris

just-boris Jun 10, 2016

No need to use Babel for that code, if you have Node > 4

No need to use Babel for that code, if you have Node > 4

@gabrielsanterre

This comment has been minimized.

Show comment
Hide comment
@gabrielsanterre

gabrielsanterre Jun 10, 2016

import express from 'express';

const app = express();
const port = 3000;

app.get('/', (req, res) => res.send('Hello World!'));
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
import express from 'express';

const app = express();
const port = 3000;

app.get('/', (req, res) => res.send('Hello World!'));
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
@elaich

This comment has been minimized.

Show comment
Hide comment

elaich commented Jun 10, 2016

Nice !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment