This API provides access to data related to Asmaul Husna and Quran Surah. It's built with FastAPI and reads data from a JSON file.
- Install required packages with
pip install fastapi uvicorn
. - Replace 'asmaul-husna.json' and 'quran.json' with the path to your JSON files.
- Save the script as 'main.py' for example.
- From the terminal, run
uvicorn main:app --reload
.
There are six available endpoints:
1. GET / Return a welcome message.
2. GET /asmaul-husna Returns all data inside 'asmaul-husna.json' file.
3. GET /asmaul-husna/{id} Returns specific data based on id from 'asmaul-husna.json' file. If the id does not exist, it will return an HTTPException with status code 404.
4. GET /asmaul-husna/random Returns a random data from 'asmaul-husna.json' file.
5. GET /quran Returns all data inside 'quran.json' file.
6. GET /quran/{nomor} Returns specific Surah based on 'nomor' from 'quran.json' file. If the 'nomor' does not exist, it will return a message "Nomor Surah not found".
Add more endpoints in the future to explore other aspects of the data provided in 'asmaul-husna.json' and 'quran.json'.