{{ app_conf.environment }}

{{ crookse.package_name }}

Latest Release {{ crookse.latest_release }}

Last updated: {{ date_last_updated.datetime }}

Getting Started

crookse.Node is a Node.js library/framework that simplifies and improves HTTP resource creation, API endpoint routing, and error handling.


All URIs are associated with a resource class (a JavaScript constructor function). Resource classes are responsible for defining the HTTP methods they allow (e.g., GET, POST, PUT, etc.); and the HTTP methods follow a semantic naming convention: HTTP_{REQUEST_METHOD}_{REQUESTED_RESPONSE_OUTPUT}(). See the example code below. The / and /home URIs, or paths, are associated with the HomeResource class. The HomeResource class has two HTTP methods defined: HTTP_GET_JSON() and HTTP_POST_JSON(). This means the /home path will only allow:

  • GET requests that request a JSON representation of the resource as the response; and
  • POST requests that request a JSON representation of the resource as the response.

All other types of requests will receive a 405 (Method Not Allowed) response.

Example of a resource file that contains the resource's paths and class


npm

Git


Before you get started

  • This quickstart guide sets you up with a very basic application that can handle JSON, HTML, and XML.

    Note: There are multiple tutorials on this site that teach you how to build apps with different technology stacks from the ground up (e.g., React, Vue.js, static HTML). If you're interested in building apps right away, then check out the links to the tutorials in the sidebar.

Steps

  1. Create your server file.
  2. Start your server.
  3. Lastly, open your web browser and navigate to localhost:1337, localhost:1337?output=html, and localhost:1337?output=xml.

If you find that something is missing in these pages (or if you find that something needs more clarification), then please file an issue at https://github.com/crookse/crookse-node-docs/issues. I would love to hear from you! You can also send me an email.