A microservice to generate text content and images based on MathML.
- Clone this repository
- Install: GitKraken and follow their guide on how to clone a repo
- Install pre-requisites: NodeJS 14.19.3 https://nodejs.org/en/blog/release/v14.19.3/ (Due to a bug in SSL, we cannot use the latest stable)
- Create a new file in the root folder for the repo called:
.env
and copy the content fromconfig.env.example
and fill in the required environment variables - Inside the repo in GitKraken, press "Show/hide terminal"
- Type
npm i -g nodemon yarn
- Type
yarn serve
- The service should now be running locally with the host details specified in the
.env
file - you can edit the files and it will update the service continuously.
- Install Docker https://www.docker.com/
- Create a new file on root folder for the repo called:
.env
and copy the content fromconfig.env.example
and fill in the required environment variables - Build the Docker image with
yarn build
- Run the Docker image in any Docker environment, the health check will report if the container is healthy or not
- You can access the container through your normal production environment with the host details specified in the
.env
file
Use "curl" from the command-line: to test this service.
Replace [HOST]
and [PORT]
with appropriate values from the .env
file.
Replace "content" with appropriate MathML that you want to test.
curl -H 'Content-Type: application/json' \
-d '{ "contentType": "math", "content": "<m:math xmlns:m=\"http://www.w3.org/1998/Math/MathML\" xml:lang=\"en\" altimg=\"img\" alttext=\"3-2=1\" display=\"block\" class=\"math\"><m:mn>3</m:mn><m:mo>-</m:mo><m:mn>2</m:mn><m:mo>=</m:mo><m:mn>1</m:mn></m:math>" }' \
-X POST \
http://[HOST]:[PORT]/