Code Monkey home page Code Monkey logo

serverblog's Introduction

Elevator-Mechanic

There shouldn't be much here that you haven't seen before. There is a simple HTTP node server.

The handler has been separated from the creation of the server. As your applications grow, separating your project into logical parts is essential.

Keeping the handlers separate also allows us to test it in isolation. This is important because we are not interested in Node HTTP's ability to trigger request events but whether or not the logic within the handler works as expected.

We are using shot to inject requests to the handler. This means we do not have to start the server or make real HTTP requests through the network stack. Instead, we inject mock requests directly to the handler and receive mock responses that we can then test. This saves us A LOT of time (real HTTP requests are slow).

We have also introduced a model file for managing your data, which is currently empty.

Tools

  • We are writing acceptance tests using Mocha and Shot.
  • We are using node's core Assert module for assertions.
  • We are writing HTTP servers using node.

Commands

  • Install dependencies with npm install
  • Start the server with make s or node server.js
  • Run the tests with make t or npm test

(If you are not familiar with Make, you might want to read Mike Bostock's article, Why Use Make).

serverblog's People

Contributors

asimjaved avatar filwisher avatar gregaubs avatar johnsmith78 avatar sofer avatar warringgod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.