This repo is created to give an overview about basics of backend frameworks Flask which is written in Python, Expressjs which is written in Nodejs and frontend library React. We created a small REST API in Flask and Expressjs which serves same json data. And frontend React uses it without any changes except API URL.
This repo is made for UMT Lahore workshop happening in March, 2018
You should have following things installed in order to run these apps.
- Python 3.6+
- Nodejs 8.x.x LTS
- Go to /backend/python
- On terminal run commands (preferably in virtualenv)
pip install -r reqs.txt
python app.py
- If everything works, your server will start at
127.0.0.1:5000
- Go to /backend/nodejs
- On terminal run commands
npm install
npm run dev
- If everything works, your server will start at
127.0.0.1:4000
- Go to /frontend
- On terminal run commands
npm install
npm start
- If everything works, your frontend changes will available at
127.0.0.1:3000
In /frontend/src/Routes.js you can switch between backend API by changing value for variable HOST_NAME
Both API's serves same data with same endpoints, except their URL which will be:
127.0.0.1:5000 for Flask
172.0.0.1:4000 for Expressjs
This endpoint will return all the departments present in database.
This endpoint will return all the data present in database.
This endpoint will filter database with given parameters. For example we want to filter all records with departement name "Support" then:
127.0.0.1:[4000|5000]/filter/depts/Support/
Other possible usage senarions could be filtering Male/Female members.
127.0.0.1:[4000|5000]/filter/gender/Male/
This endpoint will return single record by searching for id.