Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 875 Bytes

README.md

File metadata and controls

42 lines (29 loc) · 875 Bytes

Running the example

  1. Install web-push package globally on your system:
npm install web-push -g
  1. Generate vapid keys:
web-push generate-vapid-keys --json
  1. Setup the required environment variables:
  • VAPID_PUBLIC_KEY
  • VAPID_PRIVATE_KEY
  • VAPID_SUBJECT
  1. Start the server:
// Run the server/API
cd example
yarn install
yarn start:server

By default, the server is listening on port 8081. You can change it by settting the environment variable PORT to the desired value.

  1. Start the client:
// In another terminal, set the VAPID_PUBLIC_KEY environment variable and run the client app
cd example
yarn start:client
  1. Connect to localhost:8080

By default, the client is listening on port 8080. You can change it by settting the environment variable CLIENT_PORT to the desired value.