An API endpoint that returns a number of week since an arbitrary date. It also support a response format that is used by Shields.io.
To include this in your Blackboard course, in the content editor, click "Edit source" then paste in the following HTML fragment.
<a href="https://github.com/OU-CS3560/relative-week" target="_blank" rel="nofollow"><img src="https://img.shields.io/endpoint?url=https://relative-week-ksraqzy7na-uk.a.run.app?genesisDate=2024-01-15" alt="Relative Week" style="max-width: 100%;" /></a>To include the badge in a markdown file on GitHub, add
Note that any parameter for Shields.io can be overwritten. For example, if you want to remove the word "(relative)" from the label, you can provide your own label.
genesisDateAn ISO format date that represent the staring point. Note that we use week number of ISO Week Date internally. The week starts on Monday and ends on Sunday. The default value is2024-01-15(15 January 2024).tzAn IANA timezone name. The default value isAmerica/New_York.formatThe output format the function will response in. Choices ofshields-io-json,jsonortext. The first is meant to be used with Shields.io while the 2nd outputs more information for debugging. The last format is just a plain text response. The default value isshields-io-json.
npm installgcloud functions deploy relative-week \
--gen2 \
--runtime=nodejs20 \
--region=us-east4 \
--source=. \
--entry-point=relativeWeek \
--trigger-http \
--allow-unauthenticatednpm run devThen you can visit the URL show on the terminal.
npm test