Test
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
export default defineEventHandler(async () => {
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
return await $fetch(`${config.quibotBaseUrl}/motor/step`, {
|
||||
method: 'POST',
|
||||
query: {
|
||||
token: config.quibotToken,
|
||||
},
|
||||
})
|
||||
})
|
||||
18
quibot-web/server/api/motor/step/[direction].post.ts
Normal file
18
quibot-web/server/api/motor/step/[direction].post.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const config = useRuntimeConfig()
|
||||
const direction = getRouterParam(event, 'direction')
|
||||
|
||||
if (direction !== 'forward' && direction !== 'backwards') {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'Invalid motor direction',
|
||||
})
|
||||
}
|
||||
|
||||
return await $fetch(`${config.quibotBaseUrl}/motor/step/${direction}`, {
|
||||
method: 'POST',
|
||||
query: {
|
||||
token: config.quibotToken,
|
||||
},
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user