Add basic code to serve Elm page.
This commit is contained in:
parent
d05ce87808
commit
00d5d19407
2
Makefile
Normal file
2
Makefile
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
generate-elm :
|
||||||
|
cd external/GoUI && elm make Go.elm --output ../../public/js/Go.js
|
2
external/GoUI
vendored
2
external/GoUI
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 74d844b60f81ef4c4428f577d6b3c960a20f4bb6
|
Subproject commit e56560bccea5d321e6afec83f0e702478b5270e1
|
12
src/Go.cr
12
src/Go.cr
|
@ -1,6 +1,18 @@
|
||||||
require "./Go/*"
|
require "./Go/*"
|
||||||
|
require "kemal"
|
||||||
|
|
||||||
# TODO: Write documentation for `Go`
|
# TODO: Write documentation for `Go`
|
||||||
module Go
|
module Go
|
||||||
# TODO: Put your code here
|
# TODO: Put your code here
|
||||||
end
|
end
|
||||||
|
|
||||||
|
URL = "localhost"
|
||||||
|
|
||||||
|
get "/" do |env|
|
||||||
|
black = true
|
||||||
|
id = 1
|
||||||
|
size = 9
|
||||||
|
render "src/Go/views/game.ecr"
|
||||||
|
end
|
||||||
|
|
||||||
|
Kemal.run
|
||||||
|
|
17
src/Go/views/game.ecr
Normal file
17
src/Go/views/game.ecr
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="elm-root"></div>
|
||||||
|
<script src="/js/Go.js"></script>
|
||||||
|
<script>
|
||||||
|
var node = document.getElementById('elm-root')
|
||||||
|
var app = Elm.Main.embed(node, {
|
||||||
|
'black' : <%= black %>,
|
||||||
|
'url' : "<%= "ws://" + URL + ":" + Kemal.config.port.to_s %>",
|
||||||
|
'id' : <%= id %>,
|
||||||
|
'size' : <%= size %>
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user