s1eepercat
10/12/2019 - 7:26 AM

Node / React

REACT

1. in terminal to install: npm install -g create-react-app 
2. create-react-app NAME

---------------------------

NODE JS

node has no window object, it has GLOBAL
it also has PROCESS, current process
MODULE

node = to run node commands / js in your terminal
.exit / process.exit(); = to exit node

node script.js = runs script.js (needs to be in it's folder)



npm init -y = (will say YES to all questions)'
npm install nodemon --save-dev = (save dev will add module to DEV DEPENDENCIES)

nodemon = "script" : "start" : "nodemon SCRIPT.js" (npm start) = will auto run my script (like live-server, but for node)

npm install express = express node server library
npm install body-parser = should be used with express (for example to parse the body of POST forms etc)
npm intsall bcrypt = to encrypt passwords

npm install cors = enables cors.  allows restricted resources (e.g. fonts) on a web page to be requested 
from another domain outside the domain from which the first resource was served

-----
npm install knex = connection with a db
npm install pg = installs postgres
-----