This is a sample application demonstrating Employees APIs built using javaspark framework and accessing neo4j content on the backend.
These are the components of sample Employee Application:
-
Application Type: RESTful API
-
Web framework: Spark-Java (Micro-Webframework)
-
Neo4j Database Connector: Neo4j-Java-Driver for Cypher Docs
-
Database: Neo4j-Server (You may use your own neo4j instance OR Sandbox instance provided by neo4j)
-
Frontend: <coming soon>
Listed below are the API endpoints for this sample application.
// list all employees
curl http://localhost:4567/employees
// Add an employee
curl -X POST -H "Content-Type: application/json" -d '{ "id":"1", "name":"Manoj Faria" }' http://localhost:4567/employees
Hint: On Windows you may have to escape the double quotes and replace the single quotes by double quotes.
// list employee using empid
curl http://localhost:4567/employees/1
Ensure your local neo4j instance (or sandbox neo4j instance) is running.
Change the neo4j connection info (i.e. servername, port number, userid and password) in EmployeeApp.java to match your neo4j instance.
Build the jar file (target\Employee-0.0.1-SNAPSHOT-jar-with-dependencies.jar) using the below stated command:
mvn packageStart the application using:
java -jar target\Employee-0.0.1-SNAPSHOT-jar-with-dependencies.jarGo to http://localhost:4567/employees or try out any of the curl statements listed above.