Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »


Node.JS Examples:

To help get you started, we've included some example basic Node.JS script examples that you can use with the Server CLI.

Github

There are examples in the Github repo, and you can find them in the "examples" folder:

https://github.com/blinkmobile/server-cli/tree/master/examples/directory

Here you'll find a basic "helloworld" script, plus a promise based script that simulates a longer server script execution time.


Download ZIP

If you prefer, you can download the examples here, directly:

Server CLI Node Examples.zip

 

Quick Javascript Tips and Suggestions:

 

Maintainability, Sustainability

When designing your Javascript code, for longer-term maintainability and sustainability, consider:

  • Extract shared logic out into separate files, and use a module system so that you can require() as needed

  • Keep credentials and other environment variables out of your code. See dotenv or similar approaches

  • Consider keeping integration functions (e.g. network requests, libraries) separate from processing functions (e.g. transformations, data traversal) in order to make them easier to test

  • Consider writing automated tests with one of the following test frameworks or similar: avajestmochatape


Convenient HTTP Requests

Here are our favourite ways of making HTTP requests with JavaScript:


Front-End

When writing your front-end Javascript for your app:


External Resources:






  • No labels