To demonstrate the usage of NewsFetch, we have created a simple API using FastAPI.
The API is deployed on Render and can be accessed at https://api.newsfetch.tech/docs.
To use Docker images refer to the Docker page.
To install the API, first clone the repository, and navigate to the
Other installation instructions are the same as for the whole project and can be found here.
To start the API, first activate the virtual environment.
Then, make a copy of
.env, and start the API.
This will start the API with SQLite database. To use a different database, update the
The sample API uses SQLAlchemy, and supports all databases supported by SQLAlchemy.
uvicorn fast_api.main:app --reload
This will start the API on
The endpoints are documented with OpenAPI and can be accessed at
To populate the database with sample data, run the following command.
This will ingest data from the directory specified in the environment variable SOURCE_FOLDER to the database via the API. The API endpoint is specified in the environment variable API_ENDPOINT.
The data being ingested is expected to have the valid format that has been defined in the APIs datamodel.
The datamodel can be found in the file
The wire format of the data is defined in the file