Skip to content

Instantly share code, notes, and snippets.

@richardhyatt
Last active May 4, 2017 19:17
Show Gist options
  • Select an option

  • Save richardhyatt/1ede37fb387eb3bfd03dbef23fde1cae to your computer and use it in GitHub Desktop.

Select an option

Save richardhyatt/1ede37fb387eb3bfd03dbef23fde1cae to your computer and use it in GitHub Desktop.
Simple Lambda Handler using Vandium with Validation
'use strict';
const vandium = require( 'vandium' );
// our datastore
const db = require( './lib/db' );
exports.handler = vandium.api()
.POST( {
body: {
userName: vandium.types.string().min(4).max(100).required()
}
},
(event) => {
let userName = event.body.userName;
return db.addUser( userName );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment