Showing posts with the label Spark

Creating a CRUD REST API/Service with Spark

Hello everyone, today we will discuss how to build RESTful API using Spark. Spark is a micro web framework for Java. Spark aims for simplicity and provides only a minimal set of features. However, it provides everything needed to build a web application in a few lines of Java code. Spark is built around Java 8 Lambda Expression philosophy, making it less verbose than most applications inscribed in other Java frameworks. Routes   Let's list the routes that make up our API:  GET /employees — get the list of all employees  GET /employees/:id — get employees with given id  POST /employees/:id — add an employee PUT /employees/:id — edit a particular employee  DELETE /employees/:id — delete a particular employees Let's start to build RSETFul API with Spark Maven Dependencies[pom.xml] <?xml version = "1.0" encoding = "UTF-8" ?> <project xmlns = "" xmlns:xsi = "