Join us for Code @ Think 2019 | San Francisco | February 12 – 15 Register now Limited availability
By Emma Tucker, Chris Vignola | Published August 14, 2018 - Updated August 15, 2018
Cloud native technologies are built to scale and grow in public, private, and hybrid cloud environments. Because they are resilient and easy to manage, they’re becoming increasingly important in our quick-changing technology landscape.
But building cloud native applications can sometimes feel daunting. Knowing what technologies to include and how to provision them is a huge task to accomplish before you can even begin coding. According to the Cloud Native Computing Foundation, key technologies to implement and run cloud native applications include Docker, Kubernetes, Helm, and Prometheus. Plus, cloud native applications are commonly built using a microservice architecture, which is a distributed application architecture that’s comprised of multiple, separately running services.
To simplify building cloud native Node.js apps, we’ve created an open source Yeoman generator to help you create fully functional Express-based Node.js applications. The generators correspond and align directly with the modules outlined on the CloudNativeJS.io. CloudNativeJS is a community project that provides assets and tools to help you to build cloud native Node.js applications and deploy them to Docker and Kubernetes-based clouds.
The open source Yeoman generator, generator-nodeserver, creates fully functional Express-based Node.js application projects that include:
So, now that you know what the generator does, let’s get you set up using it. Follow the steps below to install and use generator-nodeserver to create an Express-based Node.js server project.
You can build/deploy these projects using standard tools like npm, Docker, and Helm, or you can use IBM Cloud Developer Tools (IDT) to simplify these tasks. The projects created by the nodeserver generator include npm scripts to help you install and use IDT — just look for the idt:* scripts in your package.json file.
Watch the videos on Quick Start for IBM Cloud to get a better idea of what IDT can do for you.
npm install -g yo
npm install -g generator-nodeserver
When you run ‘yo nodeserver’, the generator prompts you for the following:
You can also create an application using the default options by running this command:
yo nodeserver --headless
yo nodeserver --headless
which defaults to:
You can build and run the generated project locally across all operating systems (Windows, macOS, Linux etc).
To run the project locally, follow these steps:
To run the project locally with containers, follow these steps. We use IBM Cloud Developer Tools, which offers a command-driven approach for creating, developing and deploying a project and running your app locally with containers:
npm run idt:install
npm run idt:build
npm run idt:run
Here are a few quick ways to test and debug your application locally:
npm run idt:test
npm run idt:debug
idt shell run-dev
The generated projects include deployment configuration for the following environments, which are available on IBM Cloud:
To deploy to IBM Cloud, you first need to create a free account on IBM Cloud.
Then, follow these steps:
bx login or bx login
bx cs region-set <region>
bx cs cluster-config <clustername>
npm run idt:deploy -- --target container
Check out IBM Cloud App Service to generate more complex applications like a MEAN web application.
Contribute to generator-nodeserver.
The nodeserver Yeoman generator does a great job creating cloud-native projects, complete with all the essential ingredients. IDT is a great companion tool to simplify building, testing, and deploying your dockerized apps. Together, they make it a cinch to build and deploy cloud native apps to any Kubernetes environment, especially the IBM Cloud.
February 14, 2019
January 9, 2019
Back to top