
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
romcal-api
Advanced tools
REST API for liturgical calendars in Catholic Roman rite (Western Church). Powered by romcal.
REST API to get the liturgical calendar in the Catholic Roman rite.
Powered by romcal.
If you are looking to use romcal as a Node.js dependency without Express, or as a browser / front-end library, you might consider having a look to the main romcal repository instead.
Actually only Express is supported. More frameworks might be supported in the future.
$ npm install romcal-api
$ npm install express
// index.js
const express = require('express');
const romcalConfig = { baseUrl: '' }; // Optional config
const romcalMiddleware = require('romcal-api').expressMiddleware(romcalConfig);
const app = express();
const PORT = process.env.PORT || 3000;
app.use(romcalMiddleware);
app.listen(PORT, () => {
console.log(`romcal API running on port ${PORT}`);
});
$ node index.js
Actually only AWS Lambda is supported. More providers might be supported in the future.
To get started, you'll need the Serverless Framework installed. You'll also need your environment configured with AWS credentials. The steps below just gives minimal information to setup romcal-api quickly. To get help, or get the complete configuration instructions, you will find a lot more knowledge and support over internet and particularly from the serverless.com website.
First, create a new working directory for your romcal API project:
# Create a new Serverless service/project
$ serverless
# Change into the newly created directory
$ cd my-romcal-api
Then, install romcal-api:
$ npm install romcal-api
With romcal-api installed, add the application code in the handler.js
:
// handler.js
const romcalAPI = require('romcal-api');
module.exports.romcalAPI = romcalAPI.handler;
Sample settings and romcal function to add in the serverless.yml
:
# serverless.yml
provider:
name: aws
runtime: nodejs12.x
functions:
app:
handler: handler.romcalAPI
events:
- http: ANY /
- http: 'ANY {proxy+}'
When everything is set up, romcal-api is ready to be deployed:
$ sls deploy
You can use tools like Postman to play with the API.
GET /calendars
Output an Array
of calendar names, supported by romcal.
GET /locales
Output an Array
of locales keys, supported by romcal.
GET /calendar/{name}/{locale}/{date}
Output an Array
of celebrations ordered by date. For all endpoints:
{name}
: represent the name of the calendar, generally a country name. For example italy
.
If the calendar doesn't exist, romcal will return a 404 NOT FOUND
.{locale}
: represent the locale used to retrieve data. For example it
.
If the locale doesn't exist, romcal will fall back to the default en
locale.
However another specific endpoint is available to get the list of supported locales by romcal.{date}
(optional): scope the returned data to a specific period or date.{date} : Get celebrations... | Endpoint |
---|---|
For the current year: | GET /calendar/{name}/{locale} |
For a specific year: | GET /calendar/{name}/{locale}/{YYYY} |
For a specific month within a year: | GET /calendar/{name}/{locale}/{YYYY-MM} |
For a specific date: | GET /calendar/{name}/{locale}/{YYYY-MM-DD} |
For yesterday: | GET /calendar/{name}/{locale}/yesterday |
For today: | GET /calendar/{name}/{locale}/today |
For tomorrow: | GET /calendar/{name}/{locale}/tomorrow |
For a specific liturgical season within a year: The season key is described below this table. | GET /calendar/{name}/{locale}/{YYYY-season} |
For a date that matches a given liturgical celebration within a year: The celebration-lookup is described below this table.Not fully supported yet | GET /calendar/{name}/{locale}/{YYYY-celebration-lookup} |
The season
key name must be written in kebab case.
If the season key name doesn't exist, it will return an error (404 NOT FOUND
).
The available season key names are: advent
, christmastide
, early-ordinary-time
, lent
, easter-triduum
, easter-octave
, eastertide
, later-ordinary-time
, ordinary-time
.
The celebration-lookup
must be a celebration key name written in kebab case. This feature is not fully supported yet.
The endpoint will lookup for a liturgical celebration (defined by its key name), and will return all the celebrations that occur for this liturgical date (within a specific year).
The celebration with the provided key name might not be not output if this celebration has been replaced by another celebration with a higher rank.
If the celebration key name doesn't exist in romcal for a particular calendar, it will return an error (404 NOT FOUND
).
By default, each period is computed within a civil year (from 1 January to 31 December of the given year).
To get dates computed within a liturgical year, you need to specify calendar=liturgical
as a URL parameter.
When dates are computed within a liturgical period, year
corresponds to the year in which the liturgical year began.
/calendar/france/fr
return an array of dates from 1 January to 31 December of the current year./calendar/poland/pl?type=liturgical
return an array of date from the 1st Sunday of Advent to the last Saturday of Ordinary Time of the current liturgical year./calendar/canada/en/2018-12?type=liturgical
return an array of dates from December 2, 2018 (which is the first day of the liturgical year for 2018-2019) to December 31, 2018.Theses optional query strings are available for filtering data directly from the server:
weekday=[int]
: Filter the results on a specific weekday. 0
is Sunday, 6
is Saturday. For example ?weekday=0
.title=[string]
: Filter the results on a specific celebration title. The title needs to be in kebab-case. For example ?title=patron-of-europe
.You can, of course, combine different filters. For example /calendar/spain/es?weekday=4&title=martyr
group=[string]
: Calendar dates can be grouped by various criteria upon invocation like so: days
, months
, days-by-month
, weeks-by-month
, cycles
, types
, liturgical-seasons
, liturgical-colors
, psalter-weeks
.When using this parameter, romcal-api output first an Object
where keys represent the grouped data.
If the criteria aren't recognized, romcap-api will return an error (422 UNPROCESSABLE ENTRY
).
GET /version
Output an Object
containing the version of romcal-api, and the version of romcal on which this project is based.
romcal-api is in the early stages of development: the API and returned schemas could change in a near future. Any help, or simply sharing ideas on the issue tracker, are all welcome!
$ git clone https://github.com/romcal/romcal-api.git
$ cd romcal-api
$ npm install
Note: if you plan to submit Pull Requests, first you must fork this project in your own GitHub profile, and then clone your forked romcal-api
repository.
Run an Express server with a watcher. The server is reloaded each time you edit the code.
$ npm start
Or if you have Serverless installed on your machine, you can start romcal-api locally in an AWS λ and API Gateway emulator:
$ sls offline start
Execute tests once:
$ npm test
Or run a test watcher:
$ npm run test:watch
Builds all the TypeScript sources to JavaScript, allowing importing the romcal-api
module in any Node.js projects:
$ npm run build
Note: this step as well as tests are run automatically before releasing a new version to npmjs.org
.npmignore
file, and rename some files correctly to lowercase.MIT
FAQs
REST API to get the liturgical calendar in the Catholic Roman rite.
The npm package romcal-api receives a total of 3 weekly downloads. As such, romcal-api popularity was classified as not popular.
We found that romcal-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.