A toy repository to demonstrate important concepts in building an HTTP api service in clojure.
Based on https://github.com/alain-picard/simple-server-playground
- Database setup
You need a database set up to accept logins and gamestate. The default one listed in db.clj is a postgres database with the following details. {:dbtype “postgresql” :host “localhost” :dbname “postgres” :user “postgres” :password “postgres” :port 5432}
The tables can be set up with the following REPL command located in db.clj: (create-tables-if-not-existing)
Default usernames and passwords can be generated if they don’t exist with this command: db.clj => (make-default-users)
Valid username and passwords are: user pass foo bar admin 123 egg man test test
- Starting the application
Start a REPL with Figwheel. It should start a server listening on http://localhost:9500.
- Running the game
The login sets a cookie in your browser that expires in 1 hour.
A small guessing game that gives 5 tries to guess a number from 1-10. To replay, load the page again.