Font Size...
Font Family...
Font Format...
Mocking microservices in 10 minutes
An essay by Sebastien Migniot


NDLR: When, in fact, in 3 minutes

PS: As this page is both an editor and an article,
       you may need to CTRL-CLICK on the links :)

1. Countdown

Imagine you have decided to make your own microservice with those objects stored,
and definitely need it REST and fast.

Contact
name:String
email:String
.

Meeting
when:String
title:String
.



2. Creating the objects

Go to the uml editing page - works offline.


Create one of those class by pasting as text after clicking the 3rd icon
Note that the text must finish by a newline (return) followed by a dot (.)


The class appears


Now click on the 4th icon with a planet, and download the zip


3. Run using maven

I choose to extract it in ~/Code and run
mvn clean install tomee:run



The application will start in 7 seconds



4. Usage of microservice

Now start using the READ rest service


You may actually want to POST some data
curl -X POST -HContent-Type:application/json \
 http://localhost:8080/Microservice-0.0.1-SNAPSHOT/contacts/create \
 -d'{"contact":{"name":"Sebastien Migniot","email":"sebastien@migniot.com"}}'


And refresh the list


Finally, you may notice that the generated microservice
contains the source model - that generated it
may be extended afterwards - click on the generate icon again and keep your history

   

 The present article contains the source of the application described here.
 See the download the zip section just before chapter 3.
   See this blog post for the record.