1.0.0 • Published 4 years ago

nt-render v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Notification rendering service

This service handles rendering logic for a given notification event based on its type.

Key libraries being used are

LibraryDescription
mjmlmarkup language that is used to create responsive components for emails
ejsUsed to embed javascript variables into mjml components

Instructions

Starting up the server

Below are the steps to get the service running locally.

Clone the repository & Configure Environment File with the following parameters.

variableDescription
PORTPort you would like to run your service on.
DEBUGNamespace for logging events under. If you are using a logdrain service.
GOOGLE_API_KEYUsed by certain components to generate static map images.

Run npm run dev to start the server on the port specified. Repository uses nodemon to watch for any changes to the code.

Testing

Use npm test to start a new connection that watches all the changes when you are coding and reruns all the tests related to the file being changed.

Endpoints

Duns - GET

Request

KeyDescriptionValues/Example
Header/AcceptThe mime type that client supportscurrently supports text/html application/json
Param/IDThe UUID of the DUNS (Deliverable User Notification)
Body/DUNSTHe DUNS data in json that needs to be rendered

Response

If the client requests HTML it sends a well formatted HTML response for rendering in emails If client requests JSON then it responds with a well formatted JSON array with data for all the components needed. Example { type: Component Type, props: Data neeeded by the compoent }