-
Notifications
You must be signed in to change notification settings - Fork 45
an devon4j application
As an example of how a devon4ng application is built, we are going to show the MyThaiStar application frontend project, that can be found in GitHub.
The MyThaiStar application is a solution for managing the online booking and orders of a restaurant. It is presented as a showcase app but designed with real requirements in mind. Moreover, it attempts to demonstrate common features provided by many modern web apps (routing with and without guards, use of flex-box, theming, re-usable components, mock back end, …).
The main features of the app are:
-
Anonymous users can:
-
Book a table.
-
Create an event and invite some friends via email.
-
See the menu of dishes and make their own orders.
-
-
Logged-in users in the role Waiter can also:
-
Access a restricted area to see and filter the list and details of all reservations and orders made by users.
-
In this section we are going to focus on the implementation of the server project. We will show how MyThaiStar is created and how you can kickstart your own devon4j server project with the devonfw framework.
The MyThaiStar project is hosted on GitHub and includes different technologies such as Java, .NET and Node for backend solutions Angular and Xamarin as default clients.
Using the devon4j approach for the Java backend project we will have a structure of a main Maven project formed by four sub-projects:
In the core project we will store all the logic and functionality of the application.
In the api project contains the definitions of all interfaces in the application.
The batch project contains components related to the Spring Batch framework which handles batch processing.
The server project configures the packaging of the application.
In early chapters we have mentioned that the devon4j applications should be divided in different components that will provide the functionality for the different features of the application. Following the naming convention [Target]management
being the Target the main entity that we want to manage.
The components, as part of the logic of the app, are located in the core project of the app. In the case of MyThaiStar we need to show the different available dishes, we need to manage the booking and the orders and we need to create new users. So the application will be divided in the following components:
Using Spring Boot features, we can easily run our Java backend applications using the Run as > Java application over the SpringBootApp.java main class.
Once we see a console messages like:
Tomcat started on port(s): 8081 (http) Started SpringBootApp in XX.XXX seconds (JVM running for XX.XXX)
we can start accessing our Java backend.
To show the backend services results we are going to use Postman app for desktop, although you can use any other similar application.
Now, with Postman, we can do a simple GET request to obtain the info of a dish with id=1 (http://localhost:8081/mythaistar/services/rest/dishmanagement/v1/dish/1
). And we obtain a result like this:
Once we have seen what we can achieve using devon4j as our backend solution, in next sections we are going to see how to create our own devon4j project step by step, starting from how to create a new devon4j project and explaining how to generate each element of the application.
Next Chapter: Create your own devon4j App
This documentation is licensed under the Creative Commons License (Attribution-NoDerivatives 4.0 International).