ChurchLiveScheduler.api is a collection of API endpoints to retrieve and maintain a church's live stream schedule. This project is implemented as Azure HTTP Trigger functions.
The system is capable of handling both weekly events (Sunday Morning Service) and special events (Christmas Eve Service).
SQLite is used here in an attempt to keep the cost of hosting to a minimum. The database is found in the file schedule.db
Use a VS Code extension such as SQLite3 Editor to view and edit the database file.
The Getting Started with EF Core tutorial steps through creating an app that accesses SQLite.
The database connection string is configured differently if the system is running locally vs. in the cloud.
On local, the connection string is set in the local.settings.json file
{
"IsEncrypted": false,
"Values": {
"DefaultConnection": "Data Source=schedule.db"
}
}
On Azure, navigate to your Azure Function > Settings > Environment variables
Name | Value |
---|---|
DefaultConnection | Data Source=d:\home\site\wwwroot\schedule.db |
To be able to utilize this API directly from ObsChurchLowerThirds or other browser app using XHR calls, etc., you will need to enable CORS. On Azure, navigate to API > CORS > Allowed Origins: *
function requestNextService(onsuccess, onerror) {
const xhr = new XMLHttpRequest();
xhr.onload = () => {
const data = JSON.parse(xhr.responseText);
onsuccess(data.name, new Date(data.start));};
xhr.onerror = () => {
onerror(xhr.statusText);
};
xhr.open("GET", "https://churchliveschedulerapi.azurewebsites.net/api/GetNext", true);
xhr.send();
}
requestNextService(initCountdown, console.error);
function initCountdown(title, date) {
...
}