nt-render v1.0.0
Notification rendering service
This service handles rendering logic for a given notification event based on its type.
Key libraries being used are
Library | Description |
---|---|
mjml | markup language that is used to create responsive components for emails |
ejs | Used 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.
variable | Description |
---|---|
PORT | Port you would like to run your service on. |
DEBUG | Namespace for logging events under. If you are using a logdrain service. |
GOOGLE_API_KEY | Used 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
Key | Description | Values/Example |
---|---|---|
Header/Accept | The mime type that client supports | currently supports text/html application/json |
Param/ID | The UUID of the DUNS (Deliverable User Notification) | |
Body/DUNS | THe 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
}
4 years ago