Introduction

Learn about the Spark framework and its routes.

What is Spark?

Spark is a simple web framework for easily creating web applications in Java 8.

It has a really simple and terse syntax and is best used for quick development of simple web applications or web services.

Unlike many other web frameworks, Spark is super small and so it requires very little memory to run and has a fast startup time. At the same time, it has support for sessions, cookies, error handling, web-sockets, serving static files, gzip, and more.

It runs on an embedded Jetty web server when running standalone. Otherwise you can run it in any standard Java application web server, such as Tomcat.

Getting started

In a Maven build, add the following to our dependencies:

Press + to interact
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.7.1</version>
</dependency>

In a Gradle build, add the ...