leoht / acebook-kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Acebook Kotlin Template

Coaching this? Find the source here.

This template app was built using:

  • Kotlin
  • http4k for the HTTP webserver and routing
  • ktorm to integrate with the PostgreSQL database
  • Handlebars for views templating
  • JUnit and hamkrest for testing

Current features

  • Users can sign up, sign in and log out
  • The page to create a new post is implemented, but submitting it is not yet done
  • Users have to be signed in to create posts

How to setup and run

Opening the project codebase

You'll need to IntelliJ editor. If not installed already, head to https://www.jetbrains.com/idea/download/#section=mac and download the Community Edition.

Once installed, open the project directory into IntelliJ.

Setup the database

This project uses PostgreSQL as a database. You'll need to install this first.

Create two PostgreSQL databases acebook_kotlin and acebook_kotlin_test.

In both databases, import the SQL dump in the file resources/database.sql.

Running the app (dev environment)

Run the configuration "Acebook (Dev)" in the top-left corner of IntelliJ.

This should run the server on port 9000 (you can leave it running in the background).

Head to http://localhost:9000 to browse the app.

Running the app (test environment)

Run the configuration "Acebook (Test)" in the top-left corner of IntelliJ.

This should run the server on port 9999 (you can leave it running in the background).

Running the tests

First, make sure you've run the app server in test environment as explained above.

Then, use IntelliJ to run tests in the test directory.

You can do this by right-clicking on the test directory in the Project explorer, then choosing "Run 'Tests in..."

(You can also run individual tests using IntelliJ).

What are the different files?

Useful doc links

http4k: https://www.http4k.org/blog/meet_http4k/ https://www.http4k.org/guide/concepts/lens/ https://www.http4k.org/guide/howto/use_html_forms/

handlebars:

ktorm

Package

./gradlew build

Setup http4k

https://toolbox.http4k.org/

# Install the latest http4k Toolbox binary:
brew tap http4k/tap && brew install http4k

# ...then test it with:
http4k --version

How was this project setup?

@TODO


How was this resource?
😫 πŸ˜• 😐 πŸ™‚ πŸ˜€
Click an emoji to tell us.

About


Languages

Language:HTML 74.6%Language:Kotlin 15.3%Language:JavaScript 4.8%Language:CSS 3.5%Language:Handlebars 1.7%Language:Assembly 0.1%