Book Image

Learning Node.js for .NET Developers

Book Image

Learning Node.js for .NET Developers

Overview of this book

Node.js is an open source, cross-platform runtime environment that allows you to use JavaScript to develop server-side web applications. This short guide will help you develop applications using JavaScript and Node.js, leverage your existing programming skills from .NET or Java, and make the most of these other platforms through understanding the Node.js programming model. You will learn how to build web applications and APIs in Node, discover packages in the Node.js ecosystem, test and deploy your Node.js code, and more. Finally, you will discover how to integrate Node.js and .NET code.
Table of Contents (21 chapters)
Learning Node.js for .NET Developers
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Organizing your codebase


Most programming platforms provide several mechanisms for structuring your code. Consider C#/.NET or Java: you can use classes, namespaces or packages, and compilation units (assemblies or JAR/WAR files). Notice the range from small-scale organizational units (classes) to large-scale ones (assemblies). This allows you to make a codebase more approachable by providing order at each level of detail.

Classic browser-based JavaScript development was quite unstructured. Functions were the only built-in language feature for organizing your code. You could split your code into separate script files, but these all share the same global context within a web page.

Over time, people have developed ways of organizing JavaScript code. The standard approach now is to use modules. There are a few different module systems available for JavaScript, but they all work in a similar way. Each module system includes the following aspects:

  • A way of declaring a module with a name and its...