Skip to content

New HTMLRenderer service and documentation for all services#83

Merged
Prakhar896 merged 5 commits intomainfrom
prakhar
Jul 28, 2024
Merged

New HTMLRenderer service and documentation for all services#83
Prakhar896 merged 5 commits intomainfrom
prakhar

Conversation

@Prakhar896
Copy link
Copy Markdown
Contributor

Overview of changes:

  • Added documentation for all services. To see it, hover over a service's initialisation to read some usage/description information.
  • Commented out model auto-detection and importing due to arbitrary issue pertaining the disappearance of some foreign keys
  • New HTMLRenderer service that helps you render HTML templates. Useful for emailing purposes. Usage information below.

Using HTMLRenderer

  1. Create HTML templates in the ./views directory. Recommended to create email templates in the ./views/emails folder.
  2. Where you want to insert values, write {{ <KEY_NAME_HERE> }}. For example, to insert the value for key username, you would write {{ username }}.
  3. Import HTMLRenderer from ./services/HTMLRenderer
  4. Call HTMLRenderer.render and pass in the location of the template relative to the ./views directory as value as a key-value dictionary object with the values you want to fill in. Example call below.
const path = require('path')
const HTMLRenderer = require('./services/HTMLRenderer')
const htmlString = HTMLRenderer.render(path.join("emails", "ReservationConfirmation.html"), {
    username: "John Doe",
    email: "email@example.com",
    reservationReference: "ABC123"
})

@Prakhar896 Prakhar896 added the enhancement New feature or request label Jul 28, 2024
@Prakhar896 Prakhar896 merged commit a96385c into main Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant