{"id":19665967,"url":"https://github.com/microsoftedge/serviceworker-demo","last_synced_at":"2025-04-28T22:31:33.397Z","repository":{"id":76168814,"uuid":"131210569","full_name":"MicrosoftEdge/serviceworker-demo","owner":"MicrosoftEdge","description":"Service Worker demos","archived":true,"fork":false,"pushed_at":"2020-10-16T18:07:48.000Z","size":936,"stargazers_count":14,"open_issues_count":0,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-14T22:29:34.252Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MicrosoftEdge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-26T21:05:09.000Z","updated_at":"2024-12-24T06:07:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"c057377d-1efd-4d20-9c3f-c1ccf2e7e6ca","html_url":"https://github.com/MicrosoftEdge/serviceworker-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fserviceworker-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fserviceworker-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fserviceworker-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fserviceworker-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MicrosoftEdge","download_url":"https://codeload.github.com/MicrosoftEdge/serviceworker-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397613,"owners_count":21583042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T16:25:41.961Z","updated_at":"2025-04-28T22:31:33.374Z","avatar_url":"https://github.com/MicrosoftEdge.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Service Worker App Demo\n\nThis is a demo for service workers and web push notifications that work in modern web browsers.\n\n## How to use\n\nFirst, install all Node.js dependencies via `npm install`.\n\nThis demo requires access to a mongodb instance for storing push subscription info to send push updates at some other point in time. It also requires specifying a public and private key for identifying your server to the push service's server. These keys, known as VAPID public/private keys, can be generated and printed to the console when first executing the site. The site can be executed by running `node index.js` which will start a server on port `2020`. You'll need to populate those keys as environment variables and execute `node index.js` again to ensure that push messages can be configured from your server.\n\nIf you are using VS Code you can set the environment variables mentioned above in your `launch.json` file as follows:\n\n```js\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Launch demo\",\n            \"program\": \"${workspaceFolder}/serve.js\",\n            \"env\": {\n                \"DATABASE_CONNECTION_URI\": \"YOUR CONNECTION STRING\",\n                \"VAPID_PUBLIC_KEY\": \"YOUR PUBLIC KEY\",\n                \"VAPID_PRIVATE_KEY\": \"YOUR PRIVATE KEY\",\n            }\n        },\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Job\",\n            \"program\": \"${workspaceFolder}/notify.js\",\n            \"env\": {\n                \"DATABASE_CONNECTION_URI\": \"YOUR CONNECTION STRING\",\n                \"VAPID_PUBLIC_KEY\": \"YOUR PUBLIC KEY\",\n                \"VAPID_PRIVATE_KEY\": \"YOUR PRIVATE KEY\",\n            }\n        }\n    ]\n}\n```\n\nAlternatively, you can modify `configured-web-push.js` and `db.js` and set the values there explicitly:\n\n```js\nconst databaseConnectionURI = process.env.DATABASE_CONNECTION_URI || '';\nconst vapidPublicKey = process.env.VAPID_PUBLIC_KEY || '';\nconst vapidPrivateKey = process.env.VAPID_PRIVATE_KEY || '';\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftedge%2Fserviceworker-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoftedge%2Fserviceworker-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftedge%2Fserviceworker-demo/lists"}