rossi1 / news-aggregator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

News Aggregator

News Aggregator is an app you can use to obtain and aggregate news from your favorite news providers (as long as they have some API interfaces)

News Aggregator currently connects to Reddit API and NewsAPI to aggegrate news, there is an interface of course to include any other providers.

Modify the sample parse function in ./backend/app/app/deps/sample and uncomment the API_MAPPING in the API_COLLECTION list in ./backend/app/app/deps/collection to add in another provider.

Backend Requirements

Backend local development

  • Start the stack with Docker Compose:
docker-compose up -d
  • Now you can open your browser and interact with these URLs:

Backend, JSON based web API based on OpenAPI: http://localhost/api/

Automatic interactive documentation with Swagger UI (from the OpenAPI backend): http://localhost:8000/docs

Alternative automatic documentation with ReDoc (from the OpenAPI backend): http://localhost:8000/redoc

To check the logs, run:

docker-compose logs

To check the logs of a specific service, add the name of the service, e.g.:

docker-compose logs backend
You can run tests with:
docker exec -it backend pytest

Backend local development, additional details

General workflow

By default, the dependencies are managed with Poetry, go there and install it.

From ./backend/app/ you can install all the dependencies with:

$ poetry install

Then you can start a shell session with the new environment with:

$ poetry shell

Next, open your editor at ./backend/app/ (instead of the project root: ./), so that you see an ./app/ directory with your code inside. That way, your editor will be able to find all the imports, etc. Make sure your editor uses the environment you just created with Poetry.

Docker Compose files and env vars

There is a main docker-compose.yml file with all the configurations that apply to the whole stack, it is used automatically by docker-compose.

These Docker Compose files use the .env file containing configurations to be injected as environment variables in the containers.

The .env file

The .env file is the one that contains all your configurations, generated keys and passwords, etc.

URLs

These are the URLs that will be used and generated by the project.

Development URLs

Development URLs, for local development.

Backend: http://localhost:8000/api/

Automatic Interactive Docs (Swagger UI): https://localhost:8000/docs

Automatic Alternative Docs (ReDoc): https://localhost:8000/redoc

About


Languages

Language:Python 89.2%Language:Dockerfile 6.6%Language:Shell 4.2%