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
|
use Chess.Web, :controller
|
||||||
|
|
||||||
alias Chess.Game
|
alias Chess.Game
|
||||||
@ -17,11 +17,12 @@ defmodule Chess.Router do
|
|||||||
pipe_through :browser # Use the default browser stack
|
pipe_through :browser # Use the default browser stack
|
||||||
|
|
||||||
get "/", PageController, :index
|
get "/", PageController, :index
|
||||||
resources "/games", GameController
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Other scopes may use custom stacks.
|
# Other scopes may use custom stacks.
|
||||||
# scope "/api", Chess do
|
scope "/api", Chess do
|
||||||
# pipe_through :api
|
pipe_through :api
|
||||||
# end
|
|
||||||
|
resources "/games", Api.GameController, only: [:show]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class ChessBoard extends React.Component {
|
|||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const { gameId } = this.props;
|
const { gameId } = this.props;
|
||||||
|
|
||||||
$.ajax({ method: "GET", url: "/games/" + gameId })
|
$.ajax({ method: "GET", url: "/api/games/" + gameId })
|
||||||
.then(() => console.log("Oh, hai!"));
|
.then(() => console.log("Oh, hai!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
defmodule Chess.GameView do
|
defmodule Chess.Api.GameView do
|
||||||
use Chess.Web, :view
|
use Chess.Web, :view
|
||||||
|
|
||||||
def render("show.json", %{ id: 1 }) do
|
def render("show.json", %{ id: 1 }) do
|
||||||
Loading…
Reference in New Issue
Block a user