Last active
May 4, 2017 19:17
-
-
Save richardhyatt/1ede37fb387eb3bfd03dbef23fde1cae to your computer and use it in GitHub Desktop.
Simple Lambda Handler using Vandium with Validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '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