Getting started
agstack/inatrace-frontend
·
docs/getting-started.mdEdits belong in that repository, not in
agstack/docs.
Licensed under
MPL-2.0,
not this site's CC BY-SA 4.0.Running the INATrace web frontend against a local backend.
Requirements
- Node 14.x. Later majors do not work: the Angular 10 development server stops at startup with
An unhandled exception occurred: No such module: http_parser. Node 14 is past end of life, so install it next to your usual version with a version manager (nvm, asdf, volta) rather than system-wide. - Angular 10 comes from
npm install; there is nothing to install separately, and the commands below use the project’s own CLI. - WebStorm or VS Code (recommended)
- VS Code pluggins:
- Debugger for Chrome
- EditorConfig for VS Code
- npm support for VS Code
- HTML Format (from Mohamed)
- TSLint
How to run
Clone the repository
Run
npm installOpen the project in IDE of choice
Add development environment as
environment.dev.tsby copyingenvironment.tsand adding default values for configuration keys besides window environment (e.g.environmentName: window['env']['environmentName'] || 'DEV'). The file is gitignored, so every checkout needs its own.environmentName:'DEV'appBaseUrl:'http://localhost:4200'qrCodeBasePath:'q-cd'relativeFileUploadUrl:'/api/common/document'relativeFileUploadUrlManualType:'/api/common/document'relativeImageUploadUrl:'/api/common/image'relativeImageUploadUrlAllSizes:'/api/common/image'googleMapsApiKey: have to obtain a key yourselfmapboxAccessToken: have to obtain a key yourself; the plot map does not draw without it
If using Beyco integration, add the following configuration keys in
environment.ts(the values should be obtained from Beyco):beycoAuthURL:urlbeycoClientId:clientId
Run Angular server with
npm run dev
Ports
The development server listens on 4200: http://localhost:4200/
, which
redirects to /en/. It proxies /api to the backend on 8080 (see
proxy.INATrace-local.conf.json), so the browser only ever talks to 4200.
The landing page and login screen render without a backend. Everything that calls the API answers 504 until a backend is listening on 8080.
Regenerating the API client
src/api is generated from the backend’s OpenAPI document and is committed, so a normal run does
not need this step. To refresh it after the backend’s API changes, start the backend and run
npm run generate-api, which reads http://localhost:8080/v3/api-docs and fails if nothing is
serving it.