Book Image

Leaflet.js Essentials

By : Paul Crickard III, Paul Crickard
Book Image

Leaflet.js Essentials

By: Paul Crickard III, Paul Crickard

Overview of this book

Table of Contents (13 chapters)
Leaflet.js Essentials
About the Author
About the Reviewers

Building Leaflet applications with Node.js

Node.js is a JavaScript-based platform that builds non-blocking applications. The non-blocking feature is what has made Node.js extremely popular. Think about how you code. You complete tasks step-by-step. You might jump around in your code, calling functions and responding to events, but you wait until one action is complete before you start the next. With Node.js, you assign callbacks and move on to the next task or handle the next request. Take a database search, for example. In the following pseudocode, you retrieve a record and do something with it in the traditional manner:

var result = SELECT * from MyTable;
document.getElementById['results'].innerHTML= result;

In the example, you wait for the database to send back the results, and then you move on to displaying them. In Node.js, you would do something similar but assign a callback function, as shown in the following example:

function showResults(){document.getElementById['results'].innerHTML...