Refactor and expand Nunjucks templates #106
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Express introduces the concept of views and rendering, which simplifies the process of producing an HTML response. It's straightforward to use Nunjucks as the rendering engine as the
nunjucks.render
method has the same signature as thecallback
passed toExpress.engine
.The
views/
folder is now the location in which Nunjucks templates should be stored, and it currently contains:_base.njk
: the base template that all others should inherit from. It sets up the basic structure and styling._macros.njk
: basic repeatable utilities.index.njk
: Originally the dashboard, this has now been repurposed to display a list of organisations that the logged in user has access to in preparation for authentication being implemented.login.njk
: The login page. This will be displayed to the user by default if they are not logged in. It can be configured to offer either GitHub logins or username/password logins (or both).org-dashboard.njk
: The original dashboard template, repurposed to allow scoping by individual organisation.404.njk
: The page displayed when the server has no route defined for the requested URL.