/dracor-frontend

Frontend for the DraCor API

Primary LanguageHTMLMIT LicenseMIT

Frontend for dracor.org

The web app running the dracor.org website.

Development

This project was bootstrapped with Create React App. See its documentation on how to perform common tasks.

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

Note: The app expects a local eXist database with the dracor-api installed to be available at http://localhost:8080.

You can run the development frontend against a different backend by setting the environment variable REACT_APP_DRACOR_API to the respective API base URL, e.g.:

REACT_APP_DRACOR_API=https://dracor.org/api/v1 yarn start

yarn test

Launches the test runner in the interactive watch mode.
See the documentation about running tests for more information.

yarn build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.

Docker

We provide a Dockerfile that allows to build and run the DraCor Frontend in a Docker container. The DraCor API to connect the frontend to can be adjusted with the environment variable DRACOR_API_HOST (default: https://dracor.org).

# build the container
docker build -t dracor-frontend .
# run the container
docker run -it --rm -p 8088:80 dracor-frontend
# now open http://localhost:8088 in a browser

To connect the frontend to another DraCor API instance specify the environment variable DRACOR_API_HOST like this:

docker run -it --rm -p 8088:80 \
  -e DRACOR_API_HOST=https://staging.dracor.org \
  dracor-frontend

This implies that the base URL for the API is https://staging.dracor.org/api/v1. If the URL path differs from /api/v1, e.g. in a local development environment, it can be overridden with the DRACOR_API_PREFIX variable:

docker run -it --rm -p 8088:80 \
  -e DRACOR_API_HOST=https://192.168.0.10:8080 \
  -e DRACOR_API_PREFIX=/exist/restxq/v1 \
  dracor-frontend

License

dracor-frontend is MIT licensed.