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

Structuring the codebase for tests


As we write more tests for our application, we'll benefit from having more structure to our tests. It's common to have at least one test file per production module. It will also be useful to have a way of running all of our tests and seeing the overall result.

We're going to start adding tests under a test directory. From this point on in the book, we're also going to keep all of our application code under a src directory. This will make it easier to navigate our codebase and to keep production and test code separate.

If you're following along with the book at this point, you should move app.js and all the folders (apart from the bin folder) under a new src directory, and update the startup script as follows in bin/www:

var app = require('../src/app');
var debug = require('debug')('hangman:server');
var http = require('http');