Skip to content
BrunoRosendo edited this page Sep 14, 2023 · 16 revisions

Website NIAEFEUP - Backend Documentation

Welcome to the NIAEFEUP Backend Documentation!

This documentation is meant to be a guide for the development of the NIAEFEUP Backend, and is meant to be used by the developers of the project.

The project is being developed using the Spring Boot framework and the Kotlin programming language.

Contents

Development Setup

Prerequisites

Running

With IntelliJ

Simply load the Gradle project and run the application.

For automatic restart to fire up every time a source file changes, make sure that Build project automatically under File | Settings | Build, Execution, Deployment | Compiler is checked. If needed, also check Allow auto-make to start event if developed application is currently running under File | Settings | Advanced Settings.

With the command line

Run the following command in your shell:

./gradlew bootRun

Linting

We use ktlint to ensure a consistent coding style according to the community standards, through a Gradle plugin.

To make your life easier, we recommend turning on Reformat code and Optimize imports under Settings -> Tools -> Actions on Save. Additionally, you should go to Settings -> Editor -> Code Style -> Kotlin -> Imports and disable wildcard imports (use single name import for all options and remove all Packages to Use Import with '*'.

With IntelliJ

Although IntelliJ does not provide linting suggestions for Kotlin out of the box, you can use a third-party plugin to run the linter at real time.

With the command line

You can fire up the analysis yourself by running in your shell:

./gradlew ktlintCheck

You can fix the lint automatically by running in your shell:

./gradlew ktlintFormat

With a git hook

You can setup a local precommit git hook for lint analysis running a Gradle task provided by the used linting plugin:

./gradlew addKtlintCheckGitPreCommitHook

Or even an auto-format hook, if that is your thing:

./gradlew addKtlintFormatGitPreCommitHook

Testing

With IntelliJ

Run the test suite as usual, selecting the respective task for running.

With the command line

Run the following command in your shell:

./gradlew test