# Register a route which takes query parameters and extract those parameters to do the business logic

**URL:** <https://discourse.julialang.org/t/register-a-route-which-takes-query-parameters-and-extract-those-parameters-to-do-the-business-logic/56730>\
**Category:** Web Stack\
**Tags:** package, http\
**Created:** [March 8, 2021, 1:06pm UTC](https://discourse.julialang.org/t/register-a-route-which-takes-query-parameters-and-extract-those-parameters-to-do-the-business-logic/56730 "2021-03-08T13:06:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ispandey81](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ispandey81/32/21849_2.png) [@ispandey81](https://discourse.julialang.org/u/ispandey81)\
**Post date:** [March 8, 2021, 1:06pm UTC](https://discourse.julialang.org/t/register-a-route-which-takes-query-parameters-and-extract-those-parameters-to-do-the-business-logic/56730/1 "2021-03-08T13:06:49Z")

</div>

I am trying to register a route using HTTP.jl which takes a query parameter and extract that query parameter using HTTP.URIs.queryparams but cant’ get it to work. Any help appreciated. Sample code below.  
Want to invoke a GET request of the form:  
[http://localhost:8080/api/image?search=1](http://localhost:8080/api/image?search=1)

module Resource

using Dates, HTTP, JSON3

using …Model, …Service

const ROUTER = HTTP.Router()

createImage(req) = Service.createImage(JSON3.read(req.body))::Image

HTTP.@register(ROUTER, “POST”, “/api/image”, createImage)

getImage(req) = Service.getImage(get(HTTP.URIs.queryparams(req.target), “search”, nothing))::Image

HTTP.@register(ROUTER, “GET”, “/api/image”, getImage)

function requestHandler(req)

```
obj = HTTP.handle(ROUTER, req)

return HTTP.Response(200, JSON3.write(obj))

```

end

function run()

```
HTTP.serve(requestHandler, "0.0.0.0", 8080)

```

end

end # module
