anvil/striker-ui-api
2023-10-20 10:39:38 -04:00
..
out build(striker-ui-api): rebuild 2023-10-16 05:57:32 -04:00
src fix(striker-ui-api): correct ID condition in query host detail 2023-10-16 05:51:57 -04:00
.eslintignore chore(striker-ui-api): switch to TypeScript 2022-11-28 14:37:09 -05:00
.eslintrc.json chore(striker-ui-api): switch to TypeScript 2022-11-28 14:37:09 -05:00
.gitignore build(striker-ui-api): use webpack + babel (transpile) to generate output for nodejs 10 2022-03-18 22:50:41 -04:00
.prettierignore chore(striker-ui-api): switch to TypeScript 2022-11-28 14:37:09 -05:00
.prettierrc.json
Makefile.am
package-lock.json build(deps-dev): bump @babel/traverse in /striker-ui-api 2023-10-17 20:41:10 +00:00
package.json fix(striker-ui-api): replace multer with busboy for file upload 2023-08-19 04:40:33 -04:00
README.md docs(striker-ui-api): add minimal README 2023-10-10 23:02:50 -04:00
tsconfig.json chore(striker-ui-api): switch to TypeScript 2022-11-28 14:37:09 -05:00
webpack.config.js chore(striker-ui-api): add core-js and regenerator-runtime enable promises and async/await 2023-06-20 00:48:21 -04:00

Anvil system striker web interface API

About NPM projects

In essence, this module and the striker web interface module share the same management workflows:

  • All npm commands must be executed at the project root or lower level(s).
  • To prepare the workspace, run npm install.
  • To produce a production build, run npm run build.

One major difference is there's no live development mode in this project.

See the striker we interface's README for more details.

Run prerequisites

  • This API module is targetted at NodeJS version 10, which is the default on CentOS/RHEL 8.
  • All executables/files listed in src/lib/consts/SERVER_PATHS.ts and their respective dependencies are required.

Build

Run npm run build to produce a minified script at out/index.js. The output script can be executed with NodeJS assuming all prerequisites are met.

There's no need to remove the old build prior to a new build because the build process always overwrites the one file.

systemd expects the build to be placed exactly at /usr/share/striker-ui-api/index.js on a striker.

Logs

At the time of writing, no logging library was added. Logs are either stdout or stderr without levels. When the API runs as a service, its logs can be viewed with journalctl --unit striker-ui-api.

Due to the large amount of logs produced, it's highly recommended to note the time of a test, and specify a time frame with journalctl --since <date parsable time> --until <date parsable time> to help with the search.

Systemd service

The service file of this API module is located in ../units/. Environment varibles can be set with the Environment=<variable name>=<value> directive, i.e., to set the main server's port to 80, use Environment=PORT=80.

Environment varibles

Variables can be set to affect the API's funtionalities, i.e. listen on a different port. A complete list with explanations is located at src/lib/consts/ENV.ts