Last active
March 5, 2017 08:28
-
-
Save AshikNesin/37933de9395c6b7b045f9e4389a90f15 to your computer and use it in GitHub Desktop.
Kickstart a Node Project (with ES6 Import)
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
Show hidden characters
{ | |
"presets": ["es2015"], | |
"plugins": [ | |
"add-module-exports" | |
] | |
} |
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' | |
const app = express() | |
app.get('/',(req,res)=>{ | |
res.send({msg:'It works 🔥'}) | |
}) | |
app.listen(3000) | |
export default app |
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
npm init -y | |
yarn add babel-register babel-plugin-add-module-exports babel-preset-es2015 dotenv body-parser |
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
var env = process.env.NODE_ENV || 'development' | |
if (env === 'development' || env === 'test') { | |
require("babel-register"); | |
} | |
exports = module.exports = require('./app') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment