An expressive internet framework for Kotlin and Java
Spark Framework: An expressive internet framework for Kotlin and Java
Fast begin
Java
import static spark.Spark.*;
public class HelloWorld {
public static void predominant(String[] args) {
get("/hiya", (req, res) -> "Hi there World");
}
}
Kotlin
import spark.kotlin.*
enjoyable predominant(args: Array<String>) {
val http: Http = ignite()
http.get("/hiya") {
"Hi there Spark Kotlin!"
}
}
Run and consider
http://localhost:4567/hiya
Spark is sponsored by Feature Upvote. An enormous due to them for serving to the undertaking to develop.
Constructed for productiveness
Spark Framework is an easy and expressive Java/Kotlin internet framework DSL constructed for speedy growth. Sparks intention is to supply another for Kotlin/Java builders that wish to develop their internet functions as expressive as attainable and with minimal boilerplate. With a transparent philosophy Spark is designed not solely to make you extra productive, but in addition to make your code higher beneath the affect of Spark’s modern, declarative and expressive syntax.
Allows you to take full benefit of the JVM
The JVM gives one of many largest programming ecosystems on the earth. It has loads of Java internet frameworks, however pure Java internet growth has historically been very cumbersome. In the event you love the JVM, however hate verbose code and frameworks, Spark is the online framework for you. It can have you ever up and working in minutes, and you’ll even use it with Groovy or Kotlin or no matter you need. Spark is an expressive, light-weight and unopinionated pure Java (and Kotlin) internet framework that doesn’t get in your means, in contrast to in different internet frameworks, you possibly can construction your software as you need.
Microservices, microservices all over the place!
2015 was the yr of microservice hype, and now that you simply’re getting round to trying into it you’re about to understand that Spark is nice for microservices. Microservices work finest with micro frameworks, and Spark has your REST API able to serve JSON in lower than ten traces of code. Spark is principally used for creating REST API’s, but it surely additionally helps a large number of template engines. Why not create one Spark software in your backend and one in your frontend?
Some firms utilizing Spark:
NodeJS developer? Utilizing TypeScript? Attempt Spark as a substitute!
Currently, loads of server-side internet growth has been taken over by NodeJS, however a rising variety of NodeJS builders are utilizing TypeScript and different statically typed languages that compile to JavaScript. Why not go all the best way and use a language that was truly designed with sorts, and supposed to run on the server-side? You additionally get all the advantages of working your software on the JVM, the place libraries aren’t deprecated each day. In the event you’re coming from ExpressJS, then Spark’s syntax will really feel very acquainted, and in contrast to loads of JavaScript internet frameworks, Spark gained’t be deprecated tomorrow.
Typical utilization
Our 2015 survey tells us that over 50% of Spark customers use Spark to create REST APIs, whereas about 25% use Spark to create web sites. About 15% of deployed Spark functions every serve greater than 10.000 customers a day. Click on here to learn the total survey.