0.0.9 • Published 8 years ago

http-server-basic v0.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

basic-http-server

Basic HTTP server library for Node.js focused on creating simple REST services or Web-apps with minimal dependencies.

Project Objectives

  • Simplify the creating of a HTTP server for static files and web services
  • Have minimal project dependencies

Classes

  • BasicHTTPServer - Main server class
  • BaseRoute - Base class for routes, expects extending class to implement handleRequest (request, response)
  • NullRoute - Route that always returns 404. This can be used as the default handler when only sub-routes are required.
  • JSONRoute - Simple route which handles JSON parsing of the message body object. Expects extending classes to implement respond (request, response, data)

Usage Example

const BasicHTTPServer = require("basic-http-server");

const fileHandler = new BasicHTTPServer.StaticFileServer("/", "./", "index.html");
const httpServer = new BasicHTTPServer({port: 8080});
httpServer.registerDefaultHandler(fileHandler);
httpServer.start();
0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago