1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-04-29 23:20:03 +00:00

Setup basic Plug.Router framework for serving requests

Rather than use a full blown framework*, adding basic routing with
Plug.Router seems to make more sense, since I'm not planning on hosting
any content through this app. The app itself will just be endpoints for
all available services that redirect the user to an available instance
for the requested service.

Note that I might change my mind about this, but that's unlikely. At
most there would just be a home page with info about available
instances, but even then that seems kinda pointless. Trying to keep this
as absolutely simple as possible.

*like Phoenix
This commit is contained in:
Ben Busby 2021-10-22 18:28:12 -06:00
parent edcab37c7d
commit 8f762d47fa
No known key found for this signature in database
GPG key ID: 339B7B7EB5333D14
8 changed files with 59 additions and 3 deletions

18
lib/privacy_revolver.ex Normal file
View file

@ -0,0 +1,18 @@
defmodule PrivacyRevolver do
@moduledoc """
Documentation for `PrivacyRevolver`.
"""
@doc """
Hello world.
## Examples
iex> PrivacyRevolver.hello()
:world
"""
def hello do
:world
end
end

View file

@ -0,0 +1,15 @@
defmodule PrivacyRevolver.Application do
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
Plug.Cowboy.child_spec(scheme: :http, plug: PrivacyRevolver.Router, options: [port: 4001])
]
opts = [strategy: :one_for_one, name: PrivacyRevolver.Supervisor]
Supervisor.start_link(children, opts)
end
end

View file

@ -0,0 +1,10 @@
defmodule PrivacyRevolver.Router do
use Plug.Router
plug :match
plug :dispatch
get "/ping" do
send_resp(conn, 200, "pong")
end
end