Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions julia/http/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"

[compat]
HTTP = "1"
3 changes: 3 additions & 0 deletions julia/http/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
github: JuliaWeb/HTTP.jl
version: 1
6 changes: 6 additions & 0 deletions julia/http/deps.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Pkg

Pkg.activate(pwd())
Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General"))
Pkg.update()
Pkg.resolve()
10 changes: 10 additions & 0 deletions julia/http/server.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Pkg
Pkg.activate(pwd())

using HTTP

R = HTTP.Router()
HTTP.register!(R, "GET", "/", (req::HTTP.Request) -> HTTP.Response(200, ""))
HTTP.register!(R, "GET", "/user/{id}", (req::HTTP.Request) -> HTTP.Response(200, HTTP.getparams(req)["id"]))
HTTP.register!(R, "POST", "/user", (req::HTTP.Request) -> HTTP.Response(200, ""))
HTTP.serve(R, "0.0.0.0", 3000)
Loading