Giter Site home page Giter Site logo

webapiperf's Introduction

Simple Web API service in node.js

What it is

This is a simple node.js HTTP application that can be hosted in IIS using iisnode or self-hosted with node directly. It exposes two HTTP APIs:

GET /Customer/{customerId} will return a pre-baked JSON object with customer information.

POST /Order/{customerId} will accept and parse any JSON document in the body of the HTTP requst, and return a pre-baked array of JSON objects representing orders

Prerequisities

Setting up

git clone https://github.com/tjanczuk/webapiperf
cd webapiperf
npm install

Running self-hosted

cd webapiperf
node server.js

Then visit the URL http://localhost:8000/Customer/12.

By default the server will listen on port 8000. This can be overriden by setting the PORT environment variable before starting node.

The self-hosted configuration will use cluster to create as many node.exe worker processes as there are CPU cores on the machine. This allows full utilization of the CPU under stress.

Running in IIS

Create a new Web Site in IIS and point it to the webapiperf directory. Then visit the url, e.g. http://localhost:9000/Customer/12.

NOTE: the application must be hosted at the root of the web site, not in a virtual directory underneath in order for the URL paths in the application to match the requests.

webapiperf's People

Contributors

tjanczuk avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  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.