Server-side unit testing
In the previous example, we saw a way to start and run our test in Mocha. Server-side testing is important, because it helps you to know your code quality, speed, services request, and response time.
Implementing the web server
For a server-side support, we need to implement an HTTP server, which will serve our requests. Follow the points here to add a web server in our application:
- Create a subdirectory called
index.htmlfile inside. Leave the
index.htmlfile blank as of now.
- Create a file inside the
- Create a file
app.jsto add our application code. The
serverside-testingapplication directory structure will now look like this:
- Before we write any production code, let's write a ...