fix the api route to work with both get and post

the JS can use either
add test for GET on api route
Merge pull request #617 from soberstadt/fix-api-route

fix the api route to work with both get and post
Small refactor on test file [skip ci]