2.0.0 • Published 7 years ago

crookse-node v2.0.0

Weekly downloads
48
License
MIT
Repository
github
Last release
7 years ago

crookse.Node

Node.js web app library/framework that simplifies HTTP resource creation and the request-response cycle while respecting RESTful design principles.

crookse.Node Latest Release crookse.Node Build Status crookse.Node Coverage Status

// Require the package
var CrookseNode = require('crookse-node');

// Create and run the server (listens at localhost:1337 by default)
var server = CrookseNode.createServer('Server-1');
server.run();

// Add an HTTP resource that can be retrieved from the / URI
server.addHttpResources([
  {
    paths: ['/'],
    class: function HomeResource() {
      // localhost:1337
      this.HTTP_GET_JSON = () => { this.response.end(JSON.stringify({message: "You made a GET request and received a JSON response!"})); };
      // localhost:1337
      this.HTTP_POST_JSON = () => { this.response.end(JSON.stringify({message: "You made a POST request and received a JSON response!"})); };
      // localhost:1337?output=html
      this.HTTP_GET_HTML = () => { this.response.end('<p>Message:</p><p>You made a GET request and received an HTML response!</p>'); };
      // localhost:1337?output=xml
      this.HTTP_GET_XML = () => { this.response.end('<response><body><message>You made a GET request and received an XML response!</message></body></response>'); };
    }
  }
]);

crookse.Node helps you build web apps that handle requests to grab resources and return representations of those resources in different formats (e.g., HTML, JSON, XML, etc.).

Features

Installation

$ cd /path/to/your/project
$ npm install --save crookse-node
  • Note: This package was developed using Node.js v8.12.0 and npm v6.4.1

Documentation Pages

License

MIT


Thanks StackEdit and Shields.io.

2.0.0

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago