OData Server for Node.js
In this blog I want to gain your attention and give an introduction to an OpenSource project I recently started a few weeks ago on GitHub. The aim of the n-odata-server project is to develop an OData server that runs on node.js backend which helps us to develop better SAPUI5 applications in shorter time.
Why don’t you use SAP Gateway?
You would obviously ask: Why do you want to implement your own OData server. There is SAP Gateway that fulfills this perfectly. My answer is “yes” and “no”. If you are working in a SAP environment and the backend functionality has already been developed you simply implement your OData service on SAP Gateway and can develop your SAPUI5 frontend against this middleware. But what if the backend is developed at the same time as the frontend and both parts should go live at the same time in near future?
Why don’t you use Mockserver?
You would say: “There is a very good mockserver” that you can leverage to develop your SAPUI5 frontend absolutely autarkic. Again the answer is “yes” and “no”. Of course the mockserver helps very much but there is one point that bothers me.
Mockserver cannot save data to files
Developing app over a longer time
Or think about a scenario in which you develop your app over several weeks and because you also have other projects you only can spend 1 or 2 day a week on the UI5 project. In this case it would be really great if you could start with the data you entered the week before.
Another scenario is delivering of the frontend application for end-user workshops as early as possible even if your backend is still in an early development phase. If such a workshop lasts more than a few hours maybe some days the users expect that they find the data they entered the day before when they restart testing the next morning. With mockserver this is only possible if you tell your users not to shutdown the browser and the computer in the evening and not to refresh the page. But you know as me that this is ofter not possible or the end-users don’t listen to you or sometime you need to clear the browser cache.
Last but not least there are scenarios in which you don’t have a SAP backend like R/3, S/4 Hana or HANA. In this case you have to implement your backend on your own. Of course you can simply implement a RESTful JSON api with java, node.js, php, … But as SAPUI5 developer you already know and appreciate the benefits of OData. As far my research revealed there are no out-of-the-box solutions yet even no lightweight ones that can also quickly be enabled for the above mentioned other scenarios.
Next question you might ask is: “Why do you use node.js and not Java?”. I am an experience Java developer. So it would be no problem for me to leverage the Olingo library to implement an OData server with Java. But there are four reasons that lead me to node.js.
SAP commitment to node.js
Server startup time
In the Java world most of us work with a Tomcat server. Even though it is lightweight compared to SAP Web AS Java or IBM Websphere or whatever, the startup takes some time. This is annoying for every developer. A simple node.js server starts in felt no time (milliseconds).
Node.js library to support several DB-systems
Then there is this great node.js library (called package in node terminology) called loopback that abstracts the db layer. This this library it is easily possible to support several DBs like Oracle, MySQL, Postgres, MongoDB, … It supports also a flat file database for apps with small data or testing screnerios.
State of the n-odata-server project
Cause I started the project a few weeks ago and I cannot work on it every day it currently is in quite early state. Therefore it supports only basic OData scenarios at the moment.
But because I decided to develop it as an OpenSource project I hope that a few other guys also see the potential of it an contribute to it. I’m not only looking for developers. Also testers, documentation writers of even marketing people with a huge business network are welcome.
Currently we are two developers who work on this part-time.
We collaborate via Slack and manage our task with Trello and have online meetings on Google Hangout from time to time. With these tools we are extremely agile and it should be no problem to collaborate even with participants from different continents.
The future of n-odata-server
As I’m at the beginning of the development there is still a lot of work. The first step at the roadmap would be to implement the minimal OData conformance level. Later I would like to implement the intermediate and advanced conformance levels.
Additionally I would like to implement a metadata importer that generates the loopback data model from an existing OData metadata file.
Also there is room for new ideas that might come by you.
Following is a list of resources I mentioned in this blog. These may help you to get a deeper insight in what I´m technically talking about.
- n-odata-server GitHub repository
- n-odata-server-example GitHub repository. A simple sample application for the n-odata-server node.js package.
- n-odata-server npm package
- n-odata-server wiki with links to tutorials
- node.js itself
- loopback node.js package for abstracting db access
- OData website
This is the end of my short introduction to this project. I hope I could enthuse one, two or hundred people to contribute to the project.
See you on