Development Environment Setup

Introduction

Here at SoftInstigate we have developed many projects with RESTHeart.

During our projects we have been constantly enhancing our development environment and building tools to make our life easier.

This page summarizes our findings and provides you with links and tips to setup your development environment in the most effective way.

Plugin Project Skeleton

You can start developing a plugin by forking the repository restheart-plugin-skeleton

This repository includes a sample service and provides you with the following features:

feature description
Easy Execution A script allows to automatically download and run RESTHeart with your plugin. docker compose can be used to start MongoDB configured as a single instance Replica Set to enable transactions and change streams
Watch Mode You can develop in Watch Mode so that the code is automatically rebuilt, and RESTHeart automatically restarted as soon as you change a source or configuration file.
Notifications get notifications on OSX when the watcher builds and restarts RESTHeart, so you know when you can try your changes.
microD profile Start RESTHeart without the MongoDB Service. We call this profile microD, because it is an effective runtime environment for micro-services.
Debugging and Hot Code Replace RESTHeart runs in development mode, i.e. with the JVM configured for remote debugging. This also allows IDEs to dynamically apply Hot Code Replace, i.e, the code changes are automatically applied (to some extent) to the running service, without the need for rebuilding and restarting.
Native builds The skeleton pom.xml includes the native profile to build RESTHeart with the custom plugin as a native binary.

HTTP Shell

HTTP Shell provides developers with a modern alternative to HTTP clients for interacting with RESTHeart.

Download HTTP Shell from https://github.com/SoftInstigate/http-shell

Let’s see it as something between a low-level command line interface, like curl or httpie, and a more user friendly GUI client, like Postman.

The idea is that tools like curl are very powerful but a bit cumbersome, it is often hard for us to remember the exact syntax for each HTTP verb. HTTP Shell instead is still a command line interface, but with a much straightforward user experience.

HTTP Shell combines the power of familiar CLIs with visualizations in high-impact areas. HTTP Shell enables you to execute HTTP requests, manipulate complex JSON and YAML data models, integrate disparate tooling, and provides quick access to aggregate views of operational data.

HTTP Shell Image

Commands

command description example
h set auth <id> <password> opens a dialog to sets the basic authentication credentials to use in further requests > set auth
h reset auth clear the basic authentication credentials > reset auth
h set url <base-url> sets the base-url to be used in further requests > set url http://127.0.0.1:8080
h get url prints the base url > get url
h get <uri> executes the GET request to URL <base-url>+<uri> > get /collection
edit <file> opens <file> for editing with the Monaco Editor > edit body.json
h post <uri> <file> executes the POST request request to URL <base-url>+<uri>, sending the content of <file> as the request body > post /collection body.json
h put <uri> <file> executes the PUT request to URL <base-url>+<uri>, sending the content of <file> as the request body > put /collection body.json
h patch <uri> <file> executes the PATCH request to URL <base-url>+<uri>, sending the content of <file> as the request body > patch /collection body.json
h delete <uri> executes the DELETE request to URL <base-url>+<uri> > delete /collection
h set header <name> <value> sets the header <name> to <value> > set header If-Match 5f7f35efcb800f2502f95cb5
h get headers prints the current set headers > get headers
h clear headers clears the headers > clear headers