gadget-ui v 7.0.0 - Part I - NodeJS support

gadget-ui, my open source JavaScript component library, has reached a new milestone- v 7.0.0. This release contains several new features, the most significant of which have to do with NodeJS support. Recent versions of the library have required users to set up a CFML engine such as Lucee or ColdFusion to fully test all of the components in the library. The 7.0.0 release now includes a NodeJS-based solution for testing all of the library components.

NodeJS Support

The basic NodeJS solution is a very simple Express-based app that serves static files using express.static. You can run the test package by going to the root of the project and typing:

$ node index.js

Then you can access the test suite at this URL:

http://127.0.0.1:8000/test/index.htm

If you are already using port 8000 on your system, you can always change the port by modifying the port number at the bottom of the index.js page. A next release should include a command line option to specify an alternate port.

The static serving code is very straightforward. I will highlight that code here:
 

const express = require( 'express' );
const app = express();

// ...

app.use( express.static( './' ) );

/* FileUploader code here, ignored for now */

// set our listener
var server = app.listen( 8000, function(){

});

 

So this is really a minimalist solution for serving static files. Since, for the most part, gadget-ui is a client-side library, this code allows a developer to test most of the functionality of the library.

FileUploader

At this time, the FileUploader component is the only gadget-ui component that requires a server solution to fully test. The app also includes a NodeJS solution for uploading images to a server using FileUploader. While this code is a not a production-ready solution for file uploads, it contains all the necessary logic to upload an image to the server and then display it on the page. I will cover the NodeJS solution for uploading files in another post.