docker run -p 27017:27017 mongo:latest
// index.js
console.log('hello world');
// server.js
var http = require('http');
//create a server object:
http.createServer((req, res) => {
res.write('Hello World!'); //write a response to the client
res.end(); //end the response
}).listen(8080); //the server object listens on port 8080
// server.js
var http = require('http');
//create a server object:
http.createServer((req, res) => {
res.write('Hello World!'); //write a response to the client
res.end(); //end the response
}).listen(8080); //the server object listens on port 8080
process.on('SIGINT', () => {
console.log('goodbye')
process.exit(0)
})
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
add file .prettierrc
// .eslintrc.js
module.exports = {
parserOptions: {
ecmaVersion: 2018,
},
extends: ['standard', 'prettier', 'prettier/standard'],
rules: {
'no-console': 'off',
'no-var': 'error',
},
env: {
es6: true,
node: true,
},
}
// index.js
function resolveRightNowAsync() {
return new Promise((resolve, reject) => {
console.log(2)
Math.random() <= 0.5 ? resolve('success') : reject(new Error('failure'))
})
}
console.log(1)
resolveRightNowAsync()
.then(result => console.log(`3 ${result}`))
.catch(err => console.log(`3 ${err}`))
console.log(4)
One Dependency: There is just one build dependency. It uses Webpack, Babel, ESLint, and other amazing projects
No Configuration Required
No Lock-In: You can “eject” to a custom setup at any time
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Code Academy 2019</title>
</head>
<body>
<div id="root">
<h1 class="title">Hello Bro</h1>
</div>
</body>
</html>
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Code Academy 2019</title>
</head>
<body>
<div id="root"></div>
</body>
<script>
const rootElement = document.getElementById("root");
const element = document.createElement("h1");
element.textContent = "Hello bro";
element.className = "title";
rootElement.appendChild(element);
</script>
</html>
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Code Academy 2019</title>
<script
crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"
></script>
</head>
<body>
<div id="root"></div>
</body>
<script>
const rootElement = document.getElementById("root");
const element = React.createElement(
"h1",
{ className: "title" },
"Hello Bro"
);
ReactDOM.render(element, rootElement);
</script>
</html>
index.html
npm install -g parcel-bundler
npm init -y
npm i react
npm i react-dom
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Code Academy 2019</title>
</head>
<body>
<div id="root"></div>
</body>
<script src="./index.js"></script>
</html>
import React from "react";
import ReactDOM from "react-dom";
const rootElement = document.getElementById("root");
const element = React.createElement("h1", { className: "title" }, "Hello Bro");
ReactDOM.render(element, rootElement);
index.html
index.js
parcel index.html
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html"
},
package.json
<h1 className="title">Hello Bro</h1>
npm i @babel-preset-env @babel-preset-react --save-dev
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"transform-runtime",
[
"transform-react-jsx",
{
"pragma": "React.createElement"
}
]
]
}
.babelrc
{
"jsxSingleQuote": true,
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
add file .prettierrc
module.exports = {
parserOptions: {
ecmaVersion: 2018,
},
extends: [
'standard',
'standard-react',
'prettier',
'prettier/standard',
'plugin:jest/recommended',
],
rules: {
'no-console': 'off',
},
env: {
es6: true,
node: true,
},
parser: 'babel-eslint',
}