1.2.3 • Published 7 years ago

bogart-form-warden v1.2.3

Weekly downloads
21
License
-
Repository
github
Last release
7 years ago

Bogart Form Warden

Installation

  • Install with npm: npm install bogart-form-warden
  • Clone from git: git clone https://github.com/nrstott/bogart-form-warden

Usage

This package provies Form Warden JSGI middleware. Require bogart-form-warden for the middleware constructor. Use it in routes or in app.use calls.

Example of using formWarden middleware in a route:

var router = bogart.router();

var validationOptions = {
  fields: {
    email: [
      {
        isValid: 'required',
        message: 'Email is required'
      },
      {
        isValid: 'email',
        message: 'Email must be a valid email address'
      }
    ]
  }
};

router.get('/',

  formWarden(validationOptions).viewEngine(viewEngine),

  function (req) {
    var email = req.params.email;
    return viewEngine.respond('index.html', {
      locals: { email: email }
    });
  }
);

Tests

Run the tests with npm test.

Example

  • Install dependencies: npm install.
  • Run the example in the examples directory: node examples/app.js.
1.2.3

7 years ago

1.2.4

10 years ago

1.2.2

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago