Skip to content

awjacobson/ChurchLiveScheduler.api

Repository files navigation

ChurchLiveScheduler.api

CI/CD Workflow

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).

Database

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.

Connection String

The database connection string is configured differently if the system is running locally vs. in the cloud.

Localhost

On local, the connection string is set in the local.settings.json file

{
    "IsEncrypted": false,
    "Values": {
        "DefaultConnection": "Data Source=schedule.db"
    }
}

Azure

On Azure, navigate to your Azure Function > Settings > Environment variables

Name Value
DefaultConnection Data Source=d:\home\site\wwwroot\schedule.db

Azure Environment Variables

CORS

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: *

CORS

Example usage (JavaScript)

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) {
    ...
}

Further reading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages