Change package manager request signature
This commit is contained in:
parent
b3be57e0b4
commit
543cb11e69
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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: [],
|
||||||
},
|
},
|
||||||
|
|
|
@ -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 }) {
|
||||||
|
|
|
@ -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 }) {
|
||||||
|
|
Loading…
Reference in New Issue