mdchad / mpt-server

Helper server for Malaysia Prayer Time app that serve backup api and feedback messages.

Home Page:https://mpt-server.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vercel Next JS

A helper server for Malaysia Prayer Time app. Provide necessary data and procssing for the app features to work/

Getting Started

First, install the dependencies:

yarn install

(Optional) Get the Web API key from Firebase Console. Create a .env.local file and add the following:

FIREBASE_PROJECT_API_KEY=AIzaXXXXXXXXXXXXXXXXXXX

Run the development server:

yarn dev

Open http://localhost:3000 with your browser to see the result.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

How are the prayer time data is updated every month?

Fetch latest data

The data is updated automatically every month using GitHub Action. The overall flow is depicted in the diagram below.

flowchart TD
    A{{JAKIM}}
    A <--> C
    C[[Fetch latest prayer data]] --- D[(db.json)] & E[(log.json)] --> F(Commit & push)
    F -->|Vercel build triggered| G[Deployed to Vercel]
Loading

View the fetcher implementation here.

Deployment status

deploy live website deploy preview website on branches

API endpoints

Public usage

  • GET /api/solat - Get the latest prayer time data for the current month for all location
  • GET /api/solat/{locationCode} - Get the latest prayer time data for the current month for the given location. See all locationCode here.
  • GET /api/solat/{locationCode}/{day} - Same as above, but you can filter for only a day (1-31)
  • GET /api/zones - Get all the zones with Jakim code, daerah & negeri for all location.
  • GET /api/zones/{locationCode} - Note: Only give the initial string to the location code. Eg: kdh, prk, etc. Return zones only for the supplied zone.
  • GET /api/mosque/{locationCode} - Get the mosque image for the supplied location code. See all locationCode here.

Internal usage

  • POST /api/feedback

About

Helper server for Malaysia Prayer Time app that serve backup api and feedback messages.

https://mpt-server.vercel.app/


Languages

Language:TypeScript 72.9%Language:CSS 11.9%Language:Python 8.7%Language:JavaScript 6.5%