aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--.tmuxinator.yml4
-rw-r--r--Makefile24
-rw-r--r--README.md3
l---------result-client1
l---------result-server1
-rw-r--r--server/server.cabal1
-rw-r--r--server/src/Main.hs5
8 files changed, 26 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 22c4f7e..d8cc83e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@ database-shm
database-wal
dist-server
dist-client
+local.conf
public/javascript/main.js
+result-client
+result-server
sessionKey
-local.conf
diff --git a/.tmuxinator.yml b/.tmuxinator.yml
index 86612fb..48b5add 100644
--- a/.tmuxinator.yml
+++ b/.tmuxinator.yml
@@ -5,7 +5,7 @@ windows:
layout: 3747,239x59,0,0{144x59,0,0,0,94x59,145,0[94x30,145,0,1,94x28,145,31,2]}
panes:
- # Empty
- - make watch-client
- - make watch-server
+ - make clean-client watch-client
+ - make clean-server watch-server
- db:
- sqlite3 database
diff --git a/Makefile b/Makefile
index c8bb7ce..8ece441 100644
--- a/Makefile
+++ b/Makefile
@@ -5,29 +5,31 @@ stop:
@tmux kill-session -t sharedCost
dist:
- @nix-shell tools.nix --command "make clean install build"
+ @nix-build -o result-server -A ghc.server
+ @nix-build -o result-client -A ghcjs.client
+ @nix-shell -p closurecompiler --command 'closure-compiler result-client/bin/client.jsexe/all.js --js_output_file public/javascript/main.js'
-clean: clean-client clean-server
-install: install-client install-server
-build: build-client build-server
+clean: clean-server clean-client
+
+build: build-server build-client cp-client
# Client
# ------
+clean-client:
+ @rm -rf dist-client
+
build-client:
@nix-shell -A shells.ghcjs --run "build-client-inside"
build-client-inside:
- @cabal --project-file=cabal-client.project --builddir=dist-client new-build all && make cp-client
+ @cabal --project-file=cabal-client.project --builddir=dist-client new-build all
cp-client:
@cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js
-clean-client:
- @rm -rf dist-client
-
watch-client:
- @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside) || true'"
+ @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'"
# Server
# ------
@@ -42,8 +44,8 @@ build-server-inside:
@cabal --project-file=cabal-server.project --builddir=dist-server new-build all
run-server:
- @(killall sharedCost &>/dev/null) || :
+ @(fuser -k 3000/tcp &>/dev/null) || :
@./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server
watch-server:
- @nix-shell -A shells.ghc --run "nodemon --watch server --watch common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'"
+ @nix-shell -A shells.ghc --run "nodemon --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'"
diff --git a/README.md b/README.md
index b203cdb..800a984 100644
--- a/README.md
+++ b/README.md
@@ -58,11 +58,10 @@ See [application.conf](application.conf).
TODO
----
+- use jsaddle-dom in client/Main.hs
- move persistence methods to a module
- use another route to check the token and redirect to /
- Add payment balance in weekly report
- search by payment category and payment date
- Move up element ids security (editOwn is actually at db level)
-- Minify javascript
-- Extract persistence from model files
diff --git a/result-client b/result-client
new file mode 120000
index 0000000..157e7ca
--- /dev/null
+++ b/result-client
@@ -0,0 +1 @@
+/nix/store/j41w9i28pasvvy6dgqrygj34s30hscad-client-0.0.1 \ No newline at end of file
diff --git a/result-server b/result-server
new file mode 120000
index 0000000..561c4ee
--- /dev/null
+++ b/result-server
@@ -0,0 +1 @@
+/nix/store/6myvk196ip9xv91xi04g43zbqis84a1i-server-0.0.1 \ No newline at end of file
diff --git a/server/server.cabal b/server/server.cabal
index 2e1f7be..8bbe5f2 100644
--- a/server/server.cabal
+++ b/server/server.cabal
@@ -42,6 +42,7 @@ executable server
, unordered-containers
, uuid
, wai
+ , wai-extra
, wai-middleware-static
hs-source-dirs: src
default-language: Haskell2010
diff --git a/server/src/Main.hs b/server/src/Main.hs
index db73474..96c13ee 100644
--- a/server/src/Main.hs
+++ b/server/src/Main.hs
@@ -3,8 +3,10 @@
import Control.Applicative (liftA3)
import Control.Monad.IO.Class (liftIO)
-import Network.Wai.Middleware.Static
import qualified Data.Text.Lazy as LT
+import Network.Wai.Middleware.Gzip (GzipFiles(GzipCompress))
+import qualified Network.Wai.Middleware.Gzip as W
+import Network.Wai.Middleware.Static
import Web.Scotty
import qualified Conf
@@ -26,6 +28,7 @@ main = do
conf <- Conf.get "application.conf"
_ <- runDaemons conf
scotty (Conf.port conf) $ do
+ middleware $ W.gzip $ W.def { W.gzipFiles = GzipCompress }
middleware . staticPolicy $ noDots >-> addBase "public"
get "/exceedingPayer" $ do