Skip to content

Instantly share code, notes, and snippets.

@bdchauvette
Last active June 21, 2021 17:44
Show Gist options
  • Save bdchauvette/a7207d478ddb0c1daae39aebe1bd50bf to your computer and use it in GitHub Desktop.
Save bdchauvette/a7207d478ddb0c1daae39aebe1bd50bf to your computer and use it in GitHub Desktop.
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
Copy link
Author

npm install
node start
curl localhost:3000

# -> Hello World!

@smoothness
Copy link

Thanks for sharing.

@just-boris
Copy link

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

@100terres
Copy link

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
Copy link

elaich commented Jun 10, 2016

Nice !

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