Giter Site home page Giter Site logo

notification-api's Introduction

Web Push Notification Getting Started

Notifications API is used to configure and display desktop/mobile notifications

© Julien Noyer - All rights reserved for educational purposes only


Introduction

Les push notifications, ou notifications push, sont des messages d’alerte envoyés par des applications sur les téléphones mobiles et les ordinateurs. À l’origine, le terme désignait les messages sonores que l’on pouvait recevoir sur son smartphone avertissant de l’arrivée d’un nouveau mail. L’utilisation de push notification s’est répandu à d’autres applications mobiles comme les réseaux sociaux ainsi qu’au format web.

En savoir plus https://mzl.la/3KkO6w0


Utlisation de ce répertoire

Le projet développé dans ce répertoire met en place les principes de Notification Push et de WebSocket dans un serveur Node.js qui enregistre les informations de souscription dans un fichier JSON avec le module JSON Server. Le choix à été fait d'utiliser un système simple pour le stockage des informations, mais il vous faut néamoins installer JSON Server ainsi que Nodemon et les modules Node.js :

npm install -g json-server &&
npm install -g nodemon &&
npm i

Si vous avez déjà installé JSON Server et Nodemon npm i est suffisant


Une fois tous les modules installés, vous devez créer un fichier .env à la racine de votre répertoire local pour y indiquer les valeurs des différentes variables d'environnement nécessaires pour le fonctionnement de l'API :

# Serveur
PORT=...
API_URL=...
JSON_SERVER_URL=...

# Notification
PUBLIC_KEY=...
PRIVATE_KEY=...

Pour connaître vos cléfs public et privée, utiliser la méthode webpush.generateVAPIDKeys().


Pour fonctionner, l'API à besoin d'avoir accès au serveur JSON Server qui permet de manipuler le fichier db.json présent dans le dossier data, c'est pourquoi il faut dans un premier temps lancer la serveur avec la commande :

npm run db

Pour ensuite lancer l'API avec la commande :

node server.js

Su vous souhaitez utiliser Nodemon, tapez la commande npm start.

notification-api's People

Contributors

dws-paris avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.