Node.js on TIBCO Cloud? Integration
- Getting started
- My first Node.js app
- Deploy your first Node.js app
- Test your Node.js app
- Manage your Node.js apps
- Adding dependencies to your app
- Run your app locally
- Understanding the generated code
- Advanced topics
- Best practices
Now that we?ve covered the basics, let?s look at a few more advanced topics.
The first part of the tutorial started with the API first, and code second. While this is generally a very useful principle when it comes to building APIs, you can use Node.js for so many other projects as well. To make that a little easier we?ve built an extension for Microsoft Visual Studio Code that helps you with that. You can download the extension from our GitHub page. After you?ve installed it, you now have a command called
TCI: Create a new Node.js app which gives you the minimum boilerplate code you need to get started:
????<folder> ? |???manifest.json ? ????myApp | |???.env | |???package.json | |???server.js ? ????util ? ????logger.js
manifest.json file describes what kind of app this is and is used by TIBCO Cloud Integration to carry out building and deploying your app. You should never modify this file, as you might cause the deployment or build step to fail.
package.json file contains the meta data of your application (like name, version, etc.) and also contains which modules need to be downloaded to make your app work.
server.js is the main file of your application. By default the server will listen to port
8000 and that should not be changed.
.env file is used by Dotenv, a zero-dependency module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology. By default we?ve put a single entry there for the HTTP port that you can use. As a best practice this is where you should put all your configuration variables
Microsoft Visual Studio Code extension
The extension for Microsoft Visual Studio Code that you can download from our GitHub page provides a whole bunch of useful commands that speed up development. From generating boilerplate code to creating the deployment artifacts (manifest.json and zip) for you.