LH2020
We will use a microservice architecture to implement this application. Our main application will be divided into 3 primary services:
- Client
- Server
- Database
Project Directory
The root directory of the project is /LH2020
. The codebase will be set up in the following directory structure:
/LH2020
├── server/
├── client/
└── venv/
LH2020/server/
: Directory which will hold the flask API. All NLP processing will be done inside the flask instance upon request from the frontend.LH2020/client/
: Directory which will hold the ReactJS app. All user interactions will be done through here.
Development Enviornment
Setup
It is best to create a virtual enviornment for development as it segrates our codebase dependencies from other projects that could be present on your development device. We will utilize
venv
for it.Make sure that you have
python3
installed.
To setup virtual enviornment do the following:
- Navigate to the top level directory of this repository.
/LH2020
- Create the python virtual enviornment by running the following command
$ python3 -m venv venv
- Activate the virtual enviornment. You should see
(venv)
on your terminal before the current working directory.
$ . venv/bin/activate
- The project has a
requirements.txt
file which lists all the dependencies needed by the flask API. Run the following command (in the root directory with activation ofvenv
) to install all dependencies.
(venv) $ pip install -r requirements.txt
NOTE:
(venv) $
signifies that this command be issues after activating the virtual enviornment.
- The development enviornment has now been set up successfully. Once finished wth development youu can issue the following command to deactivate the virtual enviornment.
$ deactivate
NOTE
Alternatively there is a bash script which will handle all the development enviornemt=ent setup and installing the dependecies for you. YOu can run this script in yout terminal like this
$ ./setupYou might need to give the file permissions to be executable. That can be accomplished by using the
chmod
command on abash
terminal$ chmod 775 setup
Start Flask API
- Navigate to the root directory
- Activate
venv
and install all dependencies. (Could simply run thesetup
script) - run the following command
$ python server/app.py
- Navigate to
http://localhost:5000/