Tuesday, 17 March 2020

JET - with mongodb, nodejs and express

JET - v7.2.0

We all talk about the MEAN stack and the MERN stack. What about a MongoDB-Express-Nodejs-Jet stack this time? Can we call it the MENJ stack? I started on a POC and ended up on a full-blown cloud implementation of the stack. Sharing the POC results below.

Test users: refer to README.

Source code:
Oracle JET: (GitHub) hr-store
Node/Express: (GitHub) hr-server

The location/department/employee objects have been made similar to those from the HR schema, including the master child relationships. The master-detail page in the JET app implements this relationship.

Since I wrote my own middleware, I had the freedom of customizing the REST data to a standard easily suited to JET. However, I did have to extend the JET framework to support custom URL call and pagination.

This blog post may help you further to understand the master-child and search model implemented in this POC.








Translation support

The front-end JET code has been deployed on heroku server. The Node/Express middleware is running on another heroku instance. You may access and play around with the deployed instance @ https://menj-stack.herokuapp.com/

Disclaimer: since the front-end, middleware and database are all running in 3 different servers, the performance of the deployed instance is quite disappointing. But hopefully it will let you gain some amount of insight with the stack.

Cheers!

4 comments:

  1. Hi Anirban,
    How to implement dateconvertor. I have to convert in UTC.

    ReplyDelete
    Replies
    1. A date formatter is implemented in this project. You can take a look at the `helper/format-helper.js`. Additionally, the simplest way to get a UTC date is to call the toISOString() method on your date object. You can pass this string to the formatter methods.
      You can refer to:
      1) https://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.IntlDateTimeConverter.html
      2) https://jetsolutions.anirbanblogs.com/2019/01/jet-ojtable-with-custom-date-converters.html

      Delete
  2. what is "i18nutils.translate"? please elaborate

    ReplyDelete
    Replies
    1. i18nutils is a utility method that I created for translations. It refers to helpers/i18n-helper.js and uses ojs/ojtranslation. Check setup() on main.js

      Delete