Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function presetHandler. #5

Closed
Tracked by #1
SimonaPiz opened this issue Oct 9, 2023 · 0 comments · Fixed by #6
Closed
Tracked by #1

function presetHandler. #5

SimonaPiz opened this issue Oct 9, 2023 · 0 comments · Fixed by #6
Assignees
Labels
enhancement New feature or request

Comments

@SimonaPiz
Copy link
Owner

SimonaPiz commented Oct 9, 2023

This function will be called from within your server to get an existing preset or create/update a preset.
presetHandler takes up to three arguments.

  • The first argument is a string representing the request type: 'GET' or 'PUT'.
  • The second argument is the array index of the presets array.
  • For 'PUT' requests, a third argument, newPresetArray will also be passed in, representing the new drum preset array to save at that index.
  • presetHandler should return an array. This array will have one or two elements depending on how it is called. If presetHandler is called with an invalid index, it should return an array with 404 as the first element, meaning that that array index is Not Found. If index is valid, the first element of the return array should be 200, meaning the request was OK.
  • If presetHandler is called a method that is not 'GET' or 'PUT', it should return an array with 400 as the first element, meaning that it was a Bad Request.
    If the index was valid, presetHandler should also return a second element in the array. for 'GET' requests, that element should be the preset array at that array index. For 'PUT' requests, it should save the newPresetArray to that index and then also return it as the second element.
@SimonaPiz SimonaPiz mentioned this issue Oct 9, 2023
5 tasks
@SimonaPiz SimonaPiz self-assigned this Oct 9, 2023
@SimonaPiz SimonaPiz added the enhancement New feature or request label Oct 9, 2023
@SimonaPiz SimonaPiz linked a pull request Oct 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant