forked from DebaucheryLibrarian/traxxx
24 lines
682 B
JavaScript
24 lines
682 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const { fetchNetworks, fetchNetworksFromReleases } = require('../networks');
|
||
|
|
||
|
async function fetchNetworksApi(req, res) {
|
||
|
const networkId = typeof req.params.networkId === 'number' ? req.params.networkId : null;
|
||
|
const networkSlug = typeof req.params.networkId === 'string' ? req.params.networkId : null;
|
||
|
|
||
|
const networks = await fetchNetworks(networkId, networkSlug);
|
||
|
|
||
|
res.send(networks);
|
||
|
}
|
||
|
|
||
|
async function fetchNetworksFromReleasesApi(req, res) {
|
||
|
const networks = await fetchNetworksFromReleases();
|
||
|
|
||
|
res.send(networks);
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
fetchNetworks: fetchNetworksApi,
|
||
|
fetchNetworksFromReleases: fetchNetworksFromReleasesApi,
|
||
|
};
|