A simple example serveless application using the Azure Functions service in Typescript. Included is a Dockerfile
for the image and a docker-compose
file for running the image locally with authentication turned on as all authentication is turned off locally by Microsoft.
For the purpose of running the image docker and for local debugging and development the LTS version of node.js is required
- Run
npm install
from the root directory
All functions in this project have an authentication level of type 'function' therefor on execution authentication credentials must be provided via a code query string. From Azure Functions docs:
When running functions locally, authorization is disabled regardless of the specified authorization level setting. After publishing to Azure, the authLevel setting in your trigger is enforced. Keys are still required when running locally in a container.
To overcome the constraint of having to publish to Azure for authentication functionality, this project includes a host.json file that defines a key with a value of 'test' for the purpose of testing, this must be provided on all requests for authentication otherwise the response will be of status code 401.
GET: /api/dhuhr/date/2022-04-22/longitude/-0.191380?code=test
Http Method: GET
Uri Parameters:
- date: an iso 8601 date (YYYY-MM-DD)
- latitude: [-90,90]
- longitude: [-180,180]
Query Parameters:
- highLatitudeMethod: ["AngleBasedMethod" | "MiddleOfTheNightMethod" | "OneSeventhMethod"]
- convention: ["MuslimWorldLeague" | "IslamicSocietyOfNorthAmerica" | "EgyptianGeneralAuthorityOfSurvey" | "UmmAlQuraUniversityMekkah" | "UniversityOfIslamicSciencesKarachi" | "InstituteOfGeophysicsUniversityOfTehranOfSurvey" | "ShiaIthnaAshariLevaResearchInstituteQumOfSurvey"]
Example:
/api/fajr/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?code=test
/api/fajr/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?highlatitudemethod=anglebasedmethod&code=test
/api/fajr/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?convention=EgyptianGeneralAuthorityOfSurvey&code=test
/api/fajr/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?highlatitudemethod=anglebasedmethod&convention=MuslimWorldLeague&code=test
Http Method: GET
Uri Parameters:
- date: an iso 8601 date (YYYY-MM-DD)
- longitude: [-180,180]
Example:
/api/dhuhr/date/2025-01-18/longitude/-0.191380?code=test
Http Method: GET
Uri Parameters:
- date: an iso 8601 date (YYYY-MM-DD)
- latitude: [-90,90]
- longitude: [-180,180]
Query Parameters:
- madhab: ["Standard" | "Shafii" | "Maliki" | "Hanbali" | "Hanafi"]
Example:
/api/asr/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?code=test
/api/asr/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?madhab=Hanafi&code=test
Http Method: GET
Uri Parameters:
- date: an iso 8601 date (YYYY-MM-DD)
- latitude: [-90,90]
- longitude: [-180,180]
Example:
/api/maghrib/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?code=test
Http Method: GET
Uri Parameters:
- date: an iso 8601 date (YYYY-MM-DD)
- latitude: [-90,90]
- longitude: [-180,180]
Query Parameters:
- highLatitudeMethod: ["AngleBasedMethod" | "MiddleOfTheNightMethod" | "OneSeventhMethod"]
- convention: ["MuslimWorldLeague" | "IslamicSocietyOfNorthAmerica" | "EgyptianGeneralAuthorityOfSurvey" | "UmmAlQuraUniversityMekkah" | "UniversityOfIslamicSciencesKarachi" | "InstituteOfGeophysicsUniversityOfTehranOfSurvey" | "ShiaIthnaAshariLevaResearchInstituteQumOfSurvey"]
Example:
/api/ishaa/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?code=test
/api/ishaa/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?highlatitudemethod=anglebasedmethod&code=test
/api/ishaa/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?convention=EgyptianGeneralAuthorityOfSurvey&code=test
/api/ishaa/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?highlatitudemethod=anglebasedmethod&convention=UniversityOfIslamicSciencesKarachi&code=test
and as always, thanks for lookin' - Edonis 😊