advancedSE-Project
This is an API toolset that helps people organize events through streamlining the event-planning process from end to end.
Collaborators:
- Junyang Jin (UNI: jj3132)
- Elmira Aliyeva (UNI: ea2970)
- Ho Sanlok Lee (UNI: hl3436)
- Xihao Luo (UNI: xl3082)
API Specification
http://team-aapi.me/static/api.html
Home Page
http://team-aapi.me/static/index.html
*Web client is written in plain JavaScript and can be found in nginx/static
directory.
Server Status Check
$ curl team-aapi.me/health
{"commit_id":"xxxxxxx","status":"UP"}
Style Check, Test Coverage and API Tests
- Style errors:
app/bug.txt
- Test coverage report:
app/coverage.txt
- API test report:
app/postman.txt
- SonarCloud Quality status: link
Install and Run Locally
Prerequisites
Install Docker and Docker Compose. Confirm both Docker and Docker-compose are installed by:
$ docker --version
Docker version xx.xx.x, build xxxxxxx
$ docker-compose --version
docker-compose version x.xx.x, build xxxxxxxx
Start the API Server
Clone this repository and inside the repository's root directory:
# Production mode
$ docker-compose -f docker-compose.prod.yml up
# Or, development mode
$ docker-compose -f docker-compose.dev.yml up --build
The default port number is 80 for production and 3000 for development mode. Confirm that the server is running:
# Production mode
$ curl localhost/health
{"status":"UP"}
# Development mode
$ curl localhost:3000/health
{"status":"UP"}
(Optional) Visual Studio Code Environment for Developers
-
Open
/app
as the root directory in VS Code. -
Open Command Palette (
F1
key) and run "Remote-Containers: Reopen in Container". -
If prompted, select the one that says "From 'Dockerfile'".
-
(Optional) To enable IntelliSense and other debugging features, install Python VSCode extension in Dev container and set interpreter path to
/usr/local/bin/python
. -
To run
flake8
:
$ flake8
- To run
PyUnit
andcoverage
:
$ coverage run -m unittest discover test
$ coverage report --omit "test*"
Docker Commands
Shutdown server and clear containers
$ docker-compose -f docker-compose.dev.yml down
Clean up all dangling images, containers, networks, etc.
$ docker system prune
Adding new Python library
-
Add module to
/app/requirements.txt
-
Rebuild VS Code container
a. Open Command Palette (
F1
key) and run "Remote-Containers: Rebuild Container". -
Rebuild dev server
a. Close dev server
b. Clean up Docker (see abov)
c. Restart the API Server
References
- PEP 8 Style guide: https://www.python.org/dev/peps/pep-0008/
- Materialize css: https://materializecss.com/
- gitmoji: https://gitmoji.dev/