Skip to content

Boinciel/clojure-training-2024-simple-server-playground

 
 

Repository files navigation

Simple Server

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

Usage

  1. 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

  1. Starting the application

Start a REPL with Figwheel. It should start a server listening on http://localhost:9500.

  1. Running the game

Login page

The login sets a cookie in your browser that expires in 1 hour.

Guessing Game

A small guessing game that gives 5 tries to guess a number from 1-10. To replay, load the page again.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 89.5%
  • HTML 9.7%
  • CSS 0.8%