desktop view: A Food barter app where you can exchange food grown in your garden with other urban farmers or anyone who wants to eat better, reduce food waste and form a community.
mobile view:
open terminal
mkdir - myproject
make a folder for backend
cd to backend dir
brew install
brew install node
run npm init -y
// to create a package json -add name, //github if you want remember to add entry point: (index.js or server.js)
npm install express
npm install dotenv
create .gitignore file - add .env to file
create .env file
add it to .gitignore
brew install postgresql
- To work with posgres sql dbpsql postgres // to get it to connect to postgres database - log in
postgres=# //Shows your inside psql postgres db and logged in as superuser or root.
create role and password, CREATE ROLE me WITH LOGINPASSWORD ‘password’; //(hit return) then write, ALTER ROLE me CREATEDB //(we want to create db
write \d to list all users/roles in postgres
\q to quit postgres
Now in terminal, to connect to ‘me’ write: psql -d postgres -U me �//(you are now logged in as me)
(run command) CREATE DATABASE sweets;
\c mytable //(to connect to sweets database)
make a table - use postgresql docs to insert, create, update etc. example: CREATE TABLE mytable(id SERIAL PRIMARY KEY, name VARCHAR(20), description VARCHAR(25), order_date DATE;�
after creating tables, open new tab in terminal bash
Cd backend/ - go to backend folder, (inside)
npm install pg
//(node-postgres is a collection of node modules for interacting with PostgresSQL database. read node-postgres.com documentationuse express.js documentation to instantiate express connections
go back to .env file and fix according to posgres CRUD passwords, etc.
npm install -g nodemon
(to be run globally)to start it just write nodemon [your node app, server.js or index.js
use port 3001 or 3005, (react app opens http://localhost:3000 )
npm install express-jwt-authz
npm install jsonwebtoken
npm install --save jwks-rsa
npm install cors
npm install body-parser
npm install morgan
body-parser: This is a library that you will use to convert the body of incoming requests into JSON objects.
cors: This is a library that you will use to configure Express to add headers stating that your API accepts requests coming from other origins. This is also known as Cross-Origin Resource Sharing (CORS).
express: This is Express itself.
morgan: This is a library that adds some logging capabilities to your Express app.
make another directory in root folder, call it client and type:
npx create-react-app my-cool-app
OR ### yarn create react-app my-app
cd my-cool-app and npm start to see that its running on port 3000
my-cool-app’s package.json add (make sure it is the last object), ”proxy": "http://localhost:3005”} . - this is the express port to get your api’s
npm install react-router
npm install react-bootstrap
yarn add popper.js
npm install auth0
- Auth0 authenticationnpm install react-icons
- library of Fa icons and Glyphiconsnpm install react-moment
(&& moment && moment-timezone if needed see moment.js documentation) -npm axios
(only used to get users from Auth0) - fetch's cool brothercreate account with Auth0, follow documentation for react SPA & look into securing backend -- see node guidelines in Auth0 for users.