This project is a simple counter application with a backend built using FastAPI and a frontend built using Angular.
The backend is built using FastAPI and is located in the counter-app-backend
directory.
- Navigate to the
counter-app-backend
directory. - Install the required dependencies:
pip install -r requirements.txt
- Run the FastAPI application:
uvicorn main:app --host 0.0.0.0 --port 8000
GET /counter
: Returns the current value of the counter.POST /counter/increment
: Increments the counter by 1.POST /counter/decrement
: Decrements the counter by 1.POST /counter/reset
: Resets the counter to 0.
The frontend is built using Angular and is located in the counter-app-frontend
directory.
- Navigate to the
counter-app-frontend
directory. - Install the required dependencies:
npm install
- Run the development server:
ng serve
- Navigate to
http://localhost:4200/
. The application will automatically reload if you change any of the source files.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
Both the backend and frontend have Docker support.
- Navigate to the
counter-app-backend
directory. - Build the Docker image:
docker build -t counter-app-backend .
- Run the Docker container:
docker run -p 8000:8000 counter-app-backend
- Navigate to the
counter-app-frontend
directory. - Build the Docker image:
docker build -t counter-app-frontend .
- Run the Docker container:
docker run -p 4200:80 counter-app-frontend
For more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.