Duration: 4 hours
npm install
the nessecary node components- Use
python3 -m venv venv
to create a local virtual environment to work in - Activate the virtual environment
- Use
pip3 install -r requirements.txt
to install all the needed python files - Setup a postgresql database using the queries in
database.sql
- Use python3 to run the server
movies.py
npm run client
starts up the JavaScript client
- The first line (after imports) and the last couple lines work together to start the server when the script is run and keep it running as long as the script is being run name becomes main while a script is running, and by passing the script into Flask() we are making this script a Flask app. (I'm far from certain about how Flask functions)
- Next we set some global variables so the app knows how to talk with the database and initialize a psycopg2 connection and a cursor, which is how we will be making SQL queries.
@app.route
is used to define how the server will respond to different requests. I use loops to organize the data andjsonify()
to convert it into something that JavaScript can understand easily.