0

I'm using GO and chi router trying to create and endpoint filtering a table by status, but when I use the ? on the URL I'm receiving 404 page not found.

I am using the following code:

r.Get("/table?status={status}", l.Hanlder(tableHandler.GetByStatus))

When I remove the ? it works just well. I can't use it to filter? I can not, how can I do it?

Thanks in advance.

1

1 Answer 1

1

You can use the URLParam or URLParamFromCtx function to get the value of a query string parameter.

Sign up to request clarification or add additional context in comments.

4 Comments

I am using URLParam, but it still doesn't work.
You need to remove the ?status={status} from your route. It should be simply /table.
That was it! I took a little while to come back to you, but it worked, hahaha ty so much!
You’re welcome. Make sure to accept the answer so that it can help others, too!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.