Ghost/core/server/services/url/index.js
Naz 1a3a80cacc Added resource cache handling to UrlService
refs https://github.com/TryGhost/Toolbox/issues/127

- The resource cache is needed to have quick and reproducible state of the resouces tied to the urls instead of waiting for the db queries to finish.
- Allows to use UrlService without any database connection at all - useful for unit testing
2021-11-17 00:00:23 +13:00

14 lines
617 B
JavaScript

const path = require('path');
const config = require('../../../shared/config');
const UrlService = require('./UrlService');
// NOTE: instead of a path we could give UrlService a "data-resolver" of some sort
// so it doesn't have to contain the logic to read data at all. This would be
// a possible improvement in the future
const urlsCachePath = path.join(config.getContentPath('data'), 'urls.json');
const resourcesCachePath = path.join(config.getContentPath('data'), 'resources.json');
const urlService = new UrlService({urlsCachePath, resourcesCachePath});
// Singleton
module.exports = urlService;