A mirror from Github (https://github.com/dragfyre/bahai-date-api). Unchanged.
|
|
4 лет назад | |
|---|---|---|
| api | 4 лет назад | |
| bin | 5 лет назад | |
| images | 6 лет назад | |
| .editorconfig | 6 лет назад | |
| .eslintignore | 6 лет назад | |
| .eslintrc.js | 4 лет назад | |
| .gitignore | 8 лет назад | |
| LICENSE-ISC.txt | 6 лет назад | |
| README.md | 4 лет назад | |
| createServer.js | 4 лет назад | |
| package.json | 4 лет назад | |
| pnpm-lock.yaml | 4 лет назад | |
| server.js | 4 лет назад |
So far, there are three endpoints for this API:
POST /today
Returns today's date according to the Baháʼí/Badí' calendar via POST request.
GET /today
Returns today's date according to the Baháʼí/Badí' calendar via GET request (as HTML).
GET /date
Given a date from the Gregorian calendar defined via GET data, returns the corresponding date in the Baháʼí calendar (as JSON).
To launch the API server, simply navigate to the main folder and type npm start.
From either endpoint, the output is returned in a similar format: a JSON object containing a message, a Baháʼí calendar date, and a Gregorian date/time.
URL: localhost:1844/today
{
"message": "Today is 13 Masá’il 174",
"badi_date": {
"year": 174,
"month": 14,
"day": 13,
"month_name": "Masá’il"
},
"greg_date": {
"year": 2017,
"month": 12,
"day": 5,
"hour": 23,
"minute": 19,
"second": 12
}
}
URL: localhost:1844/date?year=1844&month=5&day=23&hour=20&minute=45
Output:
{
"message": "The date is: 8 ‘Aẓamat (Grandeur) 1 B.E.",
"badi_date": {
"year": 1,
"month": 3,
"day": 8,
"month_name": "‘Aẓamat (Grandeur)",
"timezone_id": "Asia/Jerusalem"
},
"greg_date": {
"year": 1844,
"month": 5,
"day": 23,
"hour": 20,
"minute": 45,
"second": 0,
"timezoneOffset": 0
}
}
URL: localhost:1844/date?year=2014&month=2&day=15&hour=13&minute=45
Output:
{
"message": "The date is: 9 Mulk (Dominion) 170 B.E.",
"badi_date": {
"year": 170,
"month": 18,
"day": 9,
"month_name": "Mulk (Dominion)",
"timezone_id": "Asia/Jerusalem"
},
"greg_date": {
"year": 2014,
"month": 2,
"day": 15,
"hour": 13,
"minute": 45,
"second": 0,
"timezoneOffset": 0
}
}