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:
parent
02ad2c951b
commit
4ee91a6228
@ -1,4 +1,4 @@
|
||||
defmodule Chess.GameController do
|
||||
defmodule Chess.Api.GameController do
|
||||
use Chess.Web, :controller
|
||||
|
||||
alias Chess.Game
|
||||
@ -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
|
||||
|
||||
@ -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!"));
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
defmodule Chess.GameView do
|
||||
defmodule Chess.Api.GameView do
|
||||
use Chess.Web, :view
|
||||
|
||||
def render("show.json", %{ id: 1 }) do
|
||||
Loading…
Reference in New Issue
Block a user