Change package manager request signature

This commit is contained in:
Thomas Hobson 2021-05-08 12:41:41 +12:00
parent b3be57e0b4
commit 543cb11e69
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
4 changed files with 13 additions and 7 deletions

View File

@ -163,10 +163,10 @@ router.get('/packages', async (req, res) => {
return res.status(200).send(packages); return res.status(200).send(packages);
}); });
router.post('/packages/:language/:version', async (req, res) => { router.post('/packages', async (req, res) => {
logger.debug('Request to install package'); logger.debug('Request to install package');
const { language, version } = req.params; const { language, version } = req.body;
const pkg = await package.get_package(language, version); const pkg = await package.get_package(language, version);
@ -192,10 +192,10 @@ router.post('/packages/:language/:version', async (req, res) => {
} }
}); });
router.delete('/packages/:language/:version', async (req, res) => { router.delete('/packages', async (req, res) => {
logger.debug('Request to uninstall package'); logger.debug('Request to uninstall package');
const { language, version } = req.params; const { language, version } = req.body;
const pkg = await package.get_package(language, version); const pkg = await package.get_package(language, version);

View File

@ -16,7 +16,7 @@ const options = [
}, },
{ {
key: 'bind_address', key: 'bind_address',
desc: 'Address to bind REST API on\nThank @Bones for the number', desc: 'Address to bind REST API on',
default: '0.0.0.0:2000', default: '0.0.0.0:2000',
validators: [], validators: [],
}, },

View File

@ -12,7 +12,10 @@ const msg_format = {
exports.handler = async ({ axios, language, version }) => { exports.handler = async ({ axios, language, version }) => {
try { try {
const install = await axios.post(`/api/v2/packages/${language}/${version || '*'}`); const install = await axios.post(`/api/v2/packages`, {
language,
version: version || '*'
});
console.log(msg_format.color(install.data)); console.log(msg_format.color(install.data));
} catch ({ response }) { } catch ({ response }) {

View File

@ -12,7 +12,10 @@ const msg_format = {
exports.handler = async ({ axios, language, version }) => { exports.handler = async ({ axios, language, version }) => {
try { try {
const uninstall = await axios.delete(`/api/v2/packages/${language}/${version || '*'}`) const install = await axios.delete(`/api/v2/packages`, {
language,
version: version || '*'
});
console.log(msg_format.color(uninstall.data)); console.log(msg_format.color(uninstall.data));
} catch ({ response }) { } catch ({ response }) {