Change to post
This commit is contained in:
parent
cef19a6ae5
commit
1a5778f414
1 changed files with 3 additions and 2 deletions
|
@ -1,14 +1,15 @@
|
|||
require('isomorphic-fetch');
|
||||
|
||||
module.exports = (router) => {
|
||||
router.get('/matelight/:command', async (ctx) => {
|
||||
router.post('/matelight/:command', async (ctx) => {
|
||||
const { command } = ctx.params;
|
||||
const res = await fetch(`http://matelight.cbrp3.c-base.org/api/${command}`);
|
||||
ctx.assert((res.status === 200), res.status);
|
||||
const body = await res.json();
|
||||
ctx.body = body;
|
||||
});
|
||||
router.get('/matelight/:command/:argument', async (ctx) => {
|
||||
router.post('/matelight/:command/:argument', async (ctx) => {
|
||||
console.log(ctx)
|
||||
const { command, argument } = ctx.params;
|
||||
const res = await fetch(`http://matelight.cbrp3.c-base.org/api/${command}/${argument}`);
|
||||
ctx.assert((res.status === 200), res.status);
|
||||
|
|
Loading…
Reference in a new issue