Skip to content

Instantly share code, notes, and snippets.

@pmauduit
Created May 21, 2018 12:00
Show Gist options
  • Save pmauduit/bcb66b15ead5593f2cbf0b4694b9b390 to your computer and use it in GitHub Desktop.
Save pmauduit/bcb66b15ead5593f2cbf0b4694b9b390 to your computer and use it in GitHub Desktop.
sparkjava simple webservice
@Grapes([
@Grab(group='com.sparkjava', module='spark-core', version='2.7.2'),
@Grab(group='org.slf4j', module='slf4j-simple', version='1.7.25', scope='test')
])
import static spark.Spark.*;
class Main {
public static void main(String[] args) {
port(8280)
get("/truc/*", { req, res -> "Hello World" })
}
}
Main.main()
@pmauduit
Copy link
Author

Note: needs groovy > 2.4.x because the groovy distribution embeds a too old version of javax.servlet (in regards to sparkframework).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment