TheScienceMuseum / collectionsonline

Science Museum Group Collection Online
https://collection.sciencemuseumgroup.org.uk
MIT License
46 stars 3 forks source link

Build Status Coverage Status

Science Museum Group: Collections Online

Getting started

  1. Install Node.js version 18 or 20. If you have nvm, you can run nvm install to automatically install and/or use an appropriate node version.
  2. Install dependencies: npm install
  3. Copy .corc.template to .corc in the project route
  4. Add required config values to .corc
  5. Start the server: npm start

Or use npm run watch to rebuild and restart the server as you edit things.

Testing

Use npm test to run all the tests (including linting).

There are two types of tests that can be run: unit and end-to-end. These can be run individually by running npm run test:unit and/or npm run test:endtoend.

Unit tests

By default, npm run test:unit syncs fixtures from the live index so you need to have a correctly configured .corc file pointing at the latest elasticsearch server.

Offline

Use npm run test:unit:tape to run the unit tests using the existing fixtures provided in the repo.

End-to-end tests

The end-to-end tests require an instance of the application to be running on http://localhost:8000.

Directory structure

.
├── bin         # Executable(s) for starting the server etc.
├── lib         # Shared modules
├── public      # Public resources exposed by the server
├── routes      # API routes
├── schemas     # Joi schemas for input validation
├── templates   # Handlebars templates - layouts, pages, partials and helpers
└── test        # Unit and integration tests

Collections

Index types

The following main 3 document types are available in the index:

Other document types:

Display names

The name of the index types isn't always obvious to the public so on the site they are mapped as follows:

Routes

To access the pages we currently have templates for, use:

The routes will not work without params, however any random string will lead you to the example pages.

Deployment

We use Travis for CI and production deployment. The .travis.yml file in the root directory contains configuration for deployments.

Setup CI

Follow these steps to setup a new CI environment:

Development Notes

Scripts

Some scripts need to be run whenever the index is updated. To do this run the command:

npm run index-update


Browser testing courtesy of BrowserStack

BrowserStack logo