This is an example minimal REST API written in Python using Flask, SQLAlchemy ORM, and a local SQLite3 database that gets generated on startup. The frontend is a React UI that fetches the content from the backend, it uses an event emitter for the sub components to easily change views. The frontend is intended to be hosted separately from Flask, using something like Nginx with SSL configured.
- React front end is intended to be hosted on S3 or behind Nginx as static files, uses NodeJS/NPM package manager to setup React development environment server
- Separate Flask backend handles REST routes and SQL, presents the data to React to view
- Uses SQLite3 for quick and easy setup
- Git clone repo and cd into it
- In one shell run the
env-setup
script from the server folder to setup virtual-env and download python packages - In another shell run
npm update
from the client folder to install dependencies for front end React development
Both backend and front end development servers automatically refresh on file changes, speeding up development time.
- Client
- From the client folder, run
npm start
to begin client side React server
- From the client folder, run
- Server
- Run
run-server
script found in the server folder, this will start the flask backend server in development mode
- Run
-
Client
- Change
config.json
in client folder to reflect the production backend server URI - In client folder run
npm run build
to build out front end of site for static web server
- Change
-
Server
- In server folder run
run-server
script, except change environment toproduction
- In server folder run