Skip to content

Latest commit

 

History

History
52 lines (45 loc) · 1.42 KB

README.md

File metadata and controls

52 lines (45 loc) · 1.42 KB

WebPush

A web push notification example with node js + react ts that runs on Chrome and Firefox



Setup

Please change the port in the index.js file (default to 80)


One-line-command

git clone https://github.com/h110m/WebPush . && npm i && cd web && npm i && npm run build && cd .. && npm start

Step-by-step

Clone the repo with

git clone https://github.com/h110m/WebPush .

Install the dependencies for the backend with

npm install

Go in the frontend folder and install the dependencies with

cd web && npm install

Build the frontend with

npm run build

Go outside the web folder and start the backend with

cd .. && npm start


How to use

You can just go to http://localhost:80 to access the website and register a webworker for your notifications. When the registration is successfull you will get an ID that you can use to make a GET request to http://localhost:80/sub/{ID} which will send a predefined hardcoded message to the device with the given ID

About this project

Well... uhm... i was just tinkering around with the web push notification api and "accidentally" wrote a neat little example on how to use the web push notification api.

Have fun tinkering with it ^-^

About me

Made with