Files
inpx-web/server/core/opds/BasePage.js
2022-11-20 17:47:15 +07:00

30 lines
604 B
JavaScript

const XmlParser = require('../xml/XmlParser');
class BasePage {
constructor(config) {
this.config = config;
this.rootTag = 'feed';
}
makeBody(content) {
if (!this.id)
throw new Error('makeBody: no id');
content.id = this.id;
const xml = new XmlParser();
const xmlObject = {};
xmlObject[this.rootTag] = content;
xml.fromObject(xmlObject);
return xml.toString({format: true});
}
async body() {
throw new Error('Body not implemented');
}
}
module.exports = BasePage;