Route Scout - Finds the paths for you!
A framework that handles the routing for you and makes your server-creating life much easier. Also makes you look younger and more attractive. Results may vary.
Features
- easy to use
- simplifies using all common routing requests
- lets you create your own routing requests
- built in handler for static files
- lets add variables to your routes
- lightweight
Is it any good?
Yes.
Installation
$ npm install route-scout
Getting Started
Route-Scout relies on the built in http node module as demonstrated below.
const routescout = ;const server = ; routescout; server;
Framework Methods
-
#### routescout.get( path, callback ) Creates a route for incoming GET requests at the passed in URL, the callback takes two arguments: request and response.
GET requests retrieve data form the server. GET reads.
-
#### routescout.post( path, callback ) Creates a route for incoming POST requests at the passed in URL, the callback takes two arguments: request and response.
POST requests are used to send data to the server. POST creates.
-
#### routescout.patch( path, callback ) Creates a route for incoming PATCH requests at the passed in URL, the callback takes two arguments: request and response.
PATCH requests change data on the server. PATCH updates/modifies
-
#### routescout.put( path, callback ) Creates a route for incoming PUT requests at the passed in URL, the callback takes two arguments: request and response.
PUT requests change or replace data on the server. PUT updates/replaces
-
#### routescout.delete( path, callback ) Creates a route for incoming DELETE requests at the passed in URL, the callback takes two arguments: request and response.
DELETE requests delete data from the server.
-
#### routescout.createRoute( object ) Creates a route for whatever you want to create a route for at the passed in URL. The object requires three keys: URL, method and handler. Method must be all uppercase!
-
#### routescout.static( path ) Serves static objects from the folder located in path.
Examples
var routescout = ; // GET Requestroutescout; // POST Requestroutescout; // PATCH Requestroutescout; // PUT requestroutescout; // DELETE Requestroutescout; // CREATE ROUTE Requestroutescout; // Static handlerroutescout;
Options
URL Variables and Request Parameters
For URL you can add a variable with a : and this will pass it to the request object with a property of params.
// Parameters in the Request objectroutescout;
Dependencies
None. We're independent that way :)