greek-manifests/controllers/manifest.mjs

25 lines
578 B
JavaScript

'use strict';
import Manifest from '../src/Manifest.js';
import Common from '../src/common.js';
/**
* Generate a manifest object to serve
* @param {string} manifestId
*/
export default async function generateManifest(manifestId) {
const IIIF_API_VERSION = process.env.IIIF_API_VERSION;
const BASE_URL = process.env.BASE_URL;
let manifest = new Manifest(IIIF_API_VERSION, BASE_URL);
manifest.generateID(manifestId);
manifest = await Common.populateCanvases(
manifest,
await Common.getImageList(manifestId),
manifestId
);
return manifest.toObject();
}