epg/scripts/core/api.js
2022-01-30 04:02:29 +03:00

15 lines
238 B
JavaScript

class API {
constructor(filepath) {
this.collection = require(filepath)
}
get(id) {
return this.collection.find(c => c.id === id)
}
}
const api = {}
api.channels = new API('../data/channels.json')
module.exports = api