Ward De Backer · Mar 5, 2025 go to post

Hi @John McBride I'm using node.js front & back-ends for many years in production. As Rob also mentions, support by InterSystems drivers is quite basic. To write scalable applications for use in production environments "the JavaScript way" you need a real Node.js back-end architecture (as mentioned in Rob's reply here) provided by the mg-dbx-napi driver (this is just the low-level driver for testing) and the QOper8 module combined with Fastify or Express (the back-end that I'm using typically).

I'm writing full-stack JS applications for 10+ years now, I used Sencha ExtJS front-end technology in the beginning but currently I'm using Vue.js and Nuxt front-ends. I'm using the REST endpoints for Vue.js and Nuxt apps served by QOper8 back-end servers. It's even possible to integrate QOper8 directly into Nuxt's server api's, but I didn't have the time yet to try this out. I'm using JS technology for 10+ years now in production and these applications are very stable.

As you'll notice, Node.js support for IRIS is mature and well supported by open-source technology. And you can take advantage of the complete Node.js module ecosystem and use it in your applications using IRIS as the underlying database + application server.

If you need to integrate a web application without a JS back-end, you can use mg_web: I'm using this technology since the year 2000 (!) and for some applications, I'm still using it without any code changes since then. This is also a very mature and well-tested back-end you can use if you want to write your application code directly in IRIS ObjectScript, without Node.js as back-end technology.

Ward De Backer · Apr 8, 2024 go to post

I did initial testing with mg_web over the weekend, it's impressive how easy you can use this module to create web pages with a Caché/IRIS instance as back-end. With the latest version, you can not only write your webpages in ObjectScript, but now also completely in JavaScript (using your data in IRIS)!

The nice thing is that this module also supports all three major webservers (Apache, Nginx and IIS).

Benchmark results look very impressive: e.g. with an IRIS db as back-end you see orders of magnitude faster performance compared to some well-known databases.

Ward De Backer · Mar 27, 2024 go to post

Hi Rob, seeing the results in the mg-showcase benchmark MD files, the speed is very impressive - you get near in-memory speed with a database!

This is very impressive work with the mg-dbx-napi connector to say at the least!

Ward De Backer · Oct 5, 2023 go to post

@Rob Tweed thanks for the correction: of course, the qewd.start  must be done before the qewd.intercept - my mistake. I changed the article text to reflect this change!

Ward De Backer · Oct 5, 2023 go to post

How about "Coffee Machine Talks"? As a lot of developers are real coffee addicts ... 😂

Ward De Backer · May 23, 2023 go to post

Great work, VSCode extensions work very well now with all latest fixes & improvements - I switched from Studio to VSCode for all ObjectScript development! 😉

Ward De Backer · May 2, 2023 go to post

Thanks for this great article @Robert Cemper ! This brings back memories ... I did some benchmark testing as a student on a DEC MicroVAX I in 1987 in VMS (using a VT100 terminal). I didn't work with M at that time yet but our retail business run by older family members started using it in +/-1986 on a PC AT (Micronetics MSM running on top of DOS) with an ISA bus terminal multiplexer card - RS232/422 cables were installed for multiple Falco VT420 terminals. Soon after, our other retail business started using Digital Unix workstations with these VT terminals too. I started programming in M in 1997 using DTM, soon followed by Open M when we grounded our current retail business and now - 26 years later - I'm writing modern apps and api's in JavaScript/ObjectScript using a Caché/IRIS + Node.js back-end running on the same globals structure! I don't think many technologies can stay relevant/on top for that long ... 😉

Ward De Backer · Mar 16, 2023 go to post

Very nice article @Maria Gladkov to start developing with VSCode! The most noteworthy extensions I'm using too in my VSCode setup:

  • Encode decode (convert text to other formats like Base64)
  • OpenAPI (swagger) Editor (specifying & documenting your REST api endpoints)
  • WSL (enabling direct use of the Windows Subsystem for Linux in VSCode)
Ward De Backer · Oct 27, 2022 go to post

Hi Rob, this backend architecture is a very good solution and makes the native API really usable for real-world scenarios. Thanks for your contribution which opens up IRIS to the Node.js JavaScript community!

Ward De Backer · Oct 24, 2022 go to post

I'm very sorry I missed this one!

My 2 cents: I think you still need both because VSCode doesn't work on older Caché versions (as you need Atelier api). But I'm looking forward to be able to move over to VSCode when all features are supported there.

Ward De Backer · Sep 29, 2022 go to post

Rob, this is a great addition to the JavaScript (Node.js) tech stack for IRIS because glsdb allows you to work with classes and globals as if they were simple JS arrays or objects. A JS developer has now persisted arrays/objects at his disposal in a very simple & familiar way.

This is a big step forward for creating Node.js back-end applications with IRIS as the underlying database when you combine this with any standard JS front-end framework + tools.

Ward De Backer · Dec 2, 2021 go to post

Very nice integration PoC, showing the power of using the Node.js ecosystem. Combining mainstream Node.js tools & modules with IRIS allows you to create very powerful applications without having to reinvent the wheel. smiley

Ward De Backer · Nov 15, 2021 go to post

It's really great to see the developer community growing to this milestone, it's a great place to meet other members, exchange ideas and new concepts. Congratulations to the whole DC team, keep the community growing! On to the upcoming next 5 years! yesyesyes

Ward De Backer · Nov 6, 2021 go to post

Front-end technology changes much faster than back-end technology. As Dmitry also suggests, for best results I can recommend you for writing web based apps to use modern front-end frameworks like Vue.js/NuxtJS, React, Angular, Svelte. These frameworks allow you to write well-structured and maintainable code, separating front-end nicely from your back-end. See also this NuxtJS tutorial article. Btw, if you're most used to HTML/CSS/JS in your pages, Vue.js will feel the most familiar to work with and it allows you too to update your existing pages gradually by including the Vue.js script in your <head> tag and start using it for parts of your existing HTML code.

To interact with you back-end IRIS/Caché server, you have two major options: using the REST application server built into IRIS/Caché (if you want to write your back-end completely in ObjectScript) or use a Node.js applications server built on the very popular Express npm module: QEWD-Up. This Node.js back-end server is both a REST & WebSockets application server. It allows you to write JavaScript both in your front-end and back-end code.

In addition, the Node.js option has the advantage you can use all existing npm modules too: for nearly every feature you can imagine, you'll find an existing npm module - you don't need to re-invent the wheel! E.g. you need Google maps in your app? There's a module for that!

WebSockets in contrast to REST give you a very efficient open connection to your IRIS/Caché back-end without the overhead of a REST call. And the most important part: QEWD-Up takes care of all setup and boilerplate code so you can focus on your application code.

Ward De Backer · Aug 23, 2021 go to post

I'm a cat fan ... wink

<object>
  <script>S tooCute=1</script>
  <cats>

  </cats>
</object>

Ward De Backer · May 14, 2021 go to post

Nice repository and a must-read, uncovering the best kept secret about the fastest databases on the IT planet! yes

Ward De Backer · Jan 26, 2019 go to post

A quick idea: doing a search for TWAIN on the NPM repository for JavaScript & Node.js, it seems you can quite easily add the ability to scan images to any web application:

  • add the Scanner.js module to your web page
  • add the scanner.scan() method in your webpage to show a native TWAIN dialog in the user's browser
  • from the examples in their developers guide, you can then show the images in the browser & upload them to the server (this should work with any back-end which allows file uploading)
  • I would upload the images to a (protected) image directory on your webserver instead of storing them as a blob inside the CACHE.DAT - your database will grow very quickly and it becomes much more difficult to show images e.g. in a browser page

You can easily search for more TWAIN npm modules on npm - Scanner.js seems to be the most popular one these days. You don't have to re-invent the wheel, npm contains a gazillion of modules for nearly every application you can think of!

Ward De Backer · Jan 24, 2019 go to post

Excellent work Rob, thank you for the hard integration work!

I got my IRIS container running on AWS in ... less than 15 mins (I used a free tier t2.micro instance). Of which 2/3 of the time was learning to know the AWS website! wink

Let's start developing now the latest React/Vue.js/... apps with QEWD.js/Node.js back-end running on IRIS ... which is very easy now because the complete back-end is in a Docker container to try out.

And you have the choice at the front-end: communicating with the back-end using WebSockets or REST endpoints using e.g. the react-qewd or vue-qewd module ... all abstracted for you using very easy methods like this.$qewd.send() (Vue.js with WebSockets) or axios.post() (using REST calls).

Ward De Backer · Jan 22, 2019 go to post

To iterate over just the global nodes you need, see my other comment below. You need an index global to do this.

Please note that QEWD.js and the Node.js adapter are very different: the Node.js client is a low-level adapter to access the Caché/IRIS database, while QEWD.js is a full multi-process back-end application server (in the underlying code, QEWD is using the ewd-document-store abstraction and, in turn, uses the IRIS node.js client to access Caché/IRIS). In fact, it removes you from writing a lot of system "plumbing" code to get your front-end code working with Caché/IRIS. You'll find QEWD examples for use with React apps at react-qewd and with Vue.js/Nuxt.js apps at vue-qewd.

Ward De Backer · Jan 21, 2019 go to post

@Fabian Pie one thing I forgot: you should also build an index from the Customer global, e.g. based on Robert's code snippet:

set id="" for {
  set id=$order(^Customer(id)) quit:id=""
  set city=$get(^Customer(id,"Address",1))
  set name=$get(^Customer(id,"Name"))
  if $length(city)&$length(name) set ^CustomerIndex(city,name,id)=""}

Now you can easily filter on the selected city and loop over the (sorted) customer names by iterating over the ^CustomerIndex global using similar JavaScript code as above. By using globals, you get sorting for free! And you don't need to traverse the whole customer global anymore.

Ward De Backer · Jan 21, 2019 go to post

Reading the comments here, it seems as we'll be short on time to show & discuss everything during the CUG meeting! wink

I'm looking forward to see these nice add-ons & howto's.

See you all at the symposium!