# Moving from Genie to HTTP (or a linux socket)

**URL:** <https://discourse.julialang.org/t/moving-from-genie-to-http-or-a-linux-socket/84341>\
**Category:** General Usage\
**Tags:** genie, sockets, http\
**Created:** [July 17, 2022, 1:33am UTC](https://discourse.julialang.org/t/moving-from-genie-to-http-or-a-linux-socket/84341 "2022-07-17T01:33:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmouts](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gmouts/32/9896_2.png) [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Post date:** [July 17, 2022, 1:33am UTC](https://discourse.julialang.org/t/moving-from-genie-to-http-or-a-linux-socket/84341/1 "2022-07-17T01:33:58Z")

</div>

I want to have a deamon running on a server and I would like to be able to change some parameters without restarting it.

My guess was that the best way to do that was by using a socket. I played a bit with genie and I ended up with a structure that works. Here’s a toy example:

```julia
using Genie, Genie.Router, Genie.Renderer.Json, Genie.Requests
using Dates

settings = Dict("a" => 1, "b" => 2, "c" => 3)

route("/config") do
  settings |> json
 end
 
route("/config", method = POST) do
  payload = jsonpayload()
  settings["a"] = payload["a"]
  settings["b"] = payload["b"]
  settings["c"] = payload["c"]
  settings |> json
end

Genie.startup()

while true
  print("$(Dates.now()): $(settings)\n")
  sleep(10)
end

```

I can run this and it prints the dictionary. Then if I run the following

```julia
using HTTP

HTTP.request("POST", "http://localhost:8000/config", [("Content-Type", "application/json")], """{"a":0, "b":0,"c":0}""")

```

The dictionary changes. That’s basically the only thing I need. I don’t need access from outside the same machine.

So far so good, but is Genie an overkill? Should I do this in HTTP? Or maybe by using a linux socket? How easy is to implement this in HTTP or with a socket?
