1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00

Move things into the API namespace

This commit is contained in:
Rob Whittaker 2016-12-09 11:59:25 +00:00 committed by Dan Barber
parent 02ad2c951b
commit 4ee91a6228
4 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
defmodule Chess.GameController do
defmodule Chess.Api.GameController do
use Chess.Web, :controller
alias Chess.Game

View File

@ -17,11 +17,12 @@ defmodule Chess.Router do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
resources "/games", GameController
end
# Other scopes may use custom stacks.
# scope "/api", Chess do
# pipe_through :api
# end
scope "/api", Chess do
pipe_through :api
resources "/games", Api.GameController, only: [:show]
end
end

View File

@ -8,7 +8,7 @@ class ChessBoard extends React.Component {
componentWillMount() {
const { gameId } = this.props;
$.ajax({ method: "GET", url: "/games/" + gameId })
$.ajax({ method: "GET", url: "/api/games/" + gameId })
.then(() => console.log("Oh, hai!"));
}

View File

@ -1,4 +1,4 @@
defmodule Chess.GameView do
defmodule Chess.Api.GameView do
use Chess.Web, :view
def render("show.json", %{ id: 1 }) do