Front end admin interface for the Find a Court or Tribunal Service.
Running the application requires the following tools to be installed in your environment:
Install dependencies by executing the following command:
$ yarn install
Bundle:
$ yarn webpack
Run:
$ yarn start:dev
The applications's home page will be available at https://localhost:3300
docker-compose up
yarn start:dev
We use ESLint alongside sass-lint
Running the linting with auto fix:
$ yarn lint --fix
This template app uses Jest as the test engine. You can run unit tests by executing the following command:
$ yarn test
Here's how to run functional tests (the template contains just one sample test):
$ yarn test:routes
Running accessibility tests:
$ yarn test:a11y
Make sure all the paths in your application are covered by accessibility tests (see a11y.ts).
To run the functional tests, you will need to add environment variables that denote the OAUTH credentials. Refer to the HMCTS confluence page, admin portal section, for more information on how to set these.
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-Policy
header
Here's an example setup:
json
"security": {
"referrerPolicy": "origin",
}
Make sure you have those values set correctly for your application.
The application exposes a health endpoint (https://localhost:3300/health), created with the use of Nodejs Healthcheck library. This endpoint is defined in health.ts file. Make sure you adjust it correctly in your application. In particular, remember to replace the sample check with checks specific to your frontend app, e.g. the ones verifying the state of each service it depends on.
This project is licensed under the MIT License, see the LICENSE file for details.