/var-http

Simple Controller based http server framework

Primary LanguageJavaMIT LicenseMIT

Var-HTTP

This project is named after the Norse god Vár, being the god of oaths and agreements (see here).


Maintained by the PSQR team.

Description

Var-HTTP is a lightweight annotation-based controller framework for Java, based on HTTP servlets. It also contains a simple servlet server based on the openjdk HTTP server, but is compatible with other servlet containers as well.

Related Projects

Var is part of the OSS Suite developed and maintained by the PSQR Team. Find below other projects of the suite :

  • ODINJector, a Java injection library
  • Valqueries, a Java ORM for relational databases
  • Valqueries CQL, a Java ORM for Cassandra
  • RAN, a Java library for automatically mapping objects to key/value structures

Getting Started

The simplest way to get started is to declare a dependency on Var-HTTP in your own Java project, using your preferred dependency management tool. Var artifacts are currently hosted on GitHub Packages. Read more on how to work with GitHub packages here.

Please note that GitHub Packages requires authentication

For Gradle :

dependencies {
    implementation 'io.var-http:var-core:1.0.1-2'
}

For Maven :

<dependency>
    <groupId>io.var-http</groupId>
    <artifactId>var-core</artifactId>
    <version>1.0.1-2</version>
</dependency> 

You should be ready to get going now ! To carry on, have a look at the var-core documentation.

Build from source

Var-HTTP uses Gradle as build tool. Its subproject "var-test" depends on another open source project called ODINjector, available here. ODIN is currently distributed using GitHub Packages, and thus requires authentication from apps to be able to access the package. Therefore, you will have to grant gradle the right to authenticate to GitHub using your account to be able to build the project fully.

Note If you do not want to add a personal access token to GitHub, you can also disable the subproject var-test. Simply comment the line mentioning "var-test" in the file settings.gradle.

Adding a GitHub personal access token for Gradle

Start by logging into your GitHub account, go to Settings > Developer Settings -> Personal access tokens. Here, click on "generate new token". Gradle only needs to access GitHub packages, so you only have to toggle "read packages". Copy the generated token. Go to your gradle home folder (on linux, it's located in ~/.gradle/) and edit the file gradle.properties. Add these two lines :

gpr.user=<your GitHub username>
gpr.key=<the token issued by github>

Build

To build it locally, start by cloning the repo. Once done, simply run ./gradlew build to build the project.

Contributing

For contribution guidelines, see CONTRIBUTING.

License

Var-HTTP is licensed under the terms of the MIT License.