Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 2.84 KB

CONTRIBUTING.md

File metadata and controls

66 lines (44 loc) · 2.84 KB

Contributing Guide

We value your participation in this open source project.

Contributors can add new useful APIs by following the below steps:

Step 1: Raise a new issue stating that you want to:

  • Add a new API that could benefit the dev community and make their life easier. Describe what the API does.
  • Improve existing API.
  • Improve the Swagger documentation that is auto-generated by FastAPI by learning how to do so in the code. Refer to FastAPI docs.

We will assign the issue to you and label it.
Step 2: Star and fork THIS repository.
Step 3: Now in your fork, make the required changes.
Step 4: Raise a PR with your changes.
Step 5: Wait for review and PR merge.

All API data and core logic resides in the foss42/foss42-core project. So, you can add new data (eg: Some specific data pertaining to a country) or improve the API logic, raise an issue in the foss42/foss42-core repository.

Please feel free to drop by our Discord server and we can have a chat in case you have any doubts.

Setting up Dev environment

  • Install the latest version of Python.
  • Clone the repo to your local sytem using git clone https://github.com/foss42/api api
  • Use terminal to navigate inside the folder (cd api).
  • Execute pip3 install -r requirements.txt to install the required python libraries.
  • Now you can serve the APIs in dev mode by:
cd src
uvicorn main:app --reload

The following output will be displayed:

src % uvicorn main:app --reload    
INFO:     Will watch for changes in these directories: ['/Users/user/Documents/api/src']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [31010] using StatReload
INFO:     Started server process [31012]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

As seen above http://127.0.0.1:8000 is the base URL.

Testing API

Visit http://127.0.0.1:8000/docs in any browser, the following Swagger docs will be visible for your dev setup:

Screenshot 2024-05-11 at 5 34 21 PM

You can test any endpoint directly by clicking on Try it out.

Screenshot 2024-05-11 at 5 36 16 PM

Now enter request params and/or body and click Execute. The result will be displayed as shown below:

Screenshot 2024-05-11 at 5 38 40 PM

You can also use API Dash to test your APIs.

Screenshot 2024-05-11 at 5 40 26 PM