Skip to content

A serverless (Azure ⚡Functions) api backend for a prayer time application; allowing for the retrieval of the five daily prayer times for any date, latitude and longitude value.

License

Notifications You must be signed in to change notification settings

doniseferi/serverlesssalah

Repository files navigation

serverlesssalah

Build Status GitHub license Codacy Badge Docker Image Version (latest by date) GitHub last commit


  1. Purpose
  2. Prerequisites
  3. Authentication Notes
  4. Endpoints
    1. Fajr
    2. Dhuhr
    3. Asr
    4. Maghrib
    5. Ishaa

Purpose

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.


Prerequisites

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

Authentication Notes

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.

Example Requests:

GET: /api/dhuhr/date/2022-04-22/longitude/-0.191380?code=test

Endpoints

Http Method: GET

Uri Parameters:

  1. date: an iso 8601 date (YYYY-MM-DD)
  2. latitude: [-90,90]
  3. 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:

  1. date: an iso 8601 date (YYYY-MM-DD)
  2. longitude: [-180,180]

Example:

/api/dhuhr/date/2025-01-18/longitude/-0.191380?code=test

Http Method: GET

Uri Parameters:

  1. date: an iso 8601 date (YYYY-MM-DD)
  2. latitude: [-90,90]
  3. 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:

  1. date: an iso 8601 date (YYYY-MM-DD)
  2. latitude: [-90,90]
  3. longitude: [-180,180]

Example:

/api/maghrib/date/2025-01-18/latitude/51.515059/longitude/-0.191380.01015?code=test

Http Method: GET

Uri Parameters:

  1. date: an iso 8601 date (YYYY-MM-DD)
  2. latitude: [-90,90]
  3. 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 😊

About

A serverless (Azure ⚡Functions) api backend for a prayer time application; allowing for the retrieval of the five daily prayer times for any date, latitude and longitude value.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages