Β This service was born out of the fact that many applications need notifications functionality nowadays, so it is extremely feasible to separate this functionality into a single microservice that can be implemented by anyone who wants to.
Β This microservice specializes in notifications, where other applications can communicate with it to send notifications. This service will only be responsible for notifications.
$ git clone https://github.com/gabrielvsc/notifications-microservice.git
$ cd notifications-microsservice
$ npm install
$ npm run start
This starts in http://localhost:3000
$ npm run test
$ npm run test:watch
$ npx prisma studio
POST /notifications
Create a Notification if you give a body with.. recipientId must be a UUID.
JSON Example:
{ "recipientId": "6d6eec98-1b86-4bda-891c-d0b595697273", "content": "New Test Notification", "category": "Test" }
GET /notifications/count/from/{recipientId}
Returns a count of {recipientId} notifications
JSON Example:
{ "count": 1 }
GET /notifications/from/{recipientId}
Returns a Array of {recipientId} notifications
JSON Example:
{ "notifications": [ { "id": "1e5d8ae6-847e-41d3-9151-ff76444b8fac", "content": "New Test Notification", "category": "Test", "recipientId": "6d6eec98-1b86-4bda-891c-d0b595697273" } ] }
POST /notifications/{id}/cancel
Cancels a {id} notification, does not remove
POST /notifications/{id}/read
Read a {id} notification.
POST /notifications/{id}/unread
Unread a {id} notification.