Files
quibot/quibot-web/server/api/motor/step/[direction].post.ts
BinarySandia04 152b541a6c
All checks were successful
Build / build-backend (push) Successful in 3s
Build / build-web (push) Successful in 13s
Build / release (push) Successful in 5s
Test
2026-04-22 13:49:12 +02:00

19 lines
470 B
TypeScript

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,
},
})
})