Skip to content

Instantly share code, notes, and snippets.

@webdeb
Created May 7, 2018 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdeb/cdc5ed46c658032e9f4eacb655ce89af to your computer and use it in GitHub Desktop.
Save webdeb/cdc5ed46c658032e9f4eacb655ce89af to your computer and use it in GitHub Desktop.
Simple plug to just fallback to the index.html file
defmodule Karta.Web.ReactPlug do
import Plug.Conn
def init(options), do: options
def call(conn, _opts) do
conn
|> put_resp_header("content-type", "text/html; charset=utf-8")
|> Plug.Conn.send_file(200, Application.app_dir(:karta_web, "priv/static/index.html"))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment