Running the frontend application requires the following tools to be installed in your environment:
Install dependencies by executing the following command:
$ yarn installBundle:
$ yarn webpackRun:
$ yarn startThe applications's home page will be available at https://localhost:4000
Create docker image:
docker-compose buildRun the application by executing the following command:
docker-compose upThis will start the frontend container exposing the application's port
(set to 4000 in this template app).
In order to test if the application is up, you can visit https://localhost:4000 in your browser. You should get a very basic home page (no styles, etc.).
We use ESLint alongside sass-lint
Running the linting with auto fix: (Prettier)
$ yarn lint --fixTo enable this to run automatically when commiting to git:
$ yarn prepareTo edit dependent or integrated services (e.g. CCD), update the reference URLs in default.yaml and values.yaml, to direct them away from the AAT default and point to a PR version (e.g. http://ccd-data-store-api-sptribs-case-api-pr-2226.preview.platform.hmcts.net).
To keep a deployment in preview add the GitHub label enable_keep_helm. Then connect to the relevant kubernetes cluster using one of the commands on the https://tools.hmcts.net/confluence/display/DATS/AKS+kubectl+cheatsheet. You can then obtain the URL for your deployment using:
kubectl -n <namespace> get ingress | grep <PR-number> e.g. kubectl -n sptribs get ingress | PR 2226
This template app uses Jest as the test engine. You can run unit tests by executing the following command:
$ yarn testHere's how to run functional tests (the template contains just one sample test):
$ yarn test:routesRunning accessibility tests:
$ yarn test:a11yMake sure all the paths in your application are covered by accessibility tests (see a11y.ts).
Cross-Site Request Forgery prevention has already been
set up in this template, at the application level. However, you need to make sure that CSRF token
is present in every HTML form that requires it. For that purpose you can use the csrfProtection macro,
included in this template app. Your njk file would look like this:
{% from "macros/csrf.njk" import csrfProtection %}
...
<form ...>
...
{{ csrfProtection(csrfToken) }}
...
</form>
...
This application uses Helmet, which adds various security-related HTTP headers to the responses. Apart from default Helmet functions, following headers are set:
There is a configuration section related with those headers, where you can specify:
referrerPolicy- value of theReferrer-Policyheader
Here's an example setup:
"security": {
"referrerPolicy": "origin",
}Make sure you have those values set correctly for your application.
The application exposes a health endpoint (https://localhost:4000/health), created with the use of Nodejs Healthcheck library.
This project is licensed under the MIT License - see the LICENSE file for details.