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'; | |
| // our datastore | |
| const db = require( './lib/db' ); | |
| exports.handler = function( event, context, callback ) { | |
| // prevent Lambda from being used in requests outside POST | |
| if( event.httpMethod !== 'POST' ) { | |
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
| { | |
| "userId": "b08f86af-35da-48f2-8fab-cef3904660bd" | |
| } |
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
| { | |
| "typ": "JWT", | |
| "alg": "HS256" | |
| } |
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' ); | |
| const bluebird = require( 'bluebird' ); | |
| // our nosql datastore - promisified | |
| const db = bluebird.promisifyAll( require( './lib/db' ) ); | |
| // message service - promisified |
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
| vandium.jwt.configure( { | |
| algorithm: 'HS256', | |
| secret: 'secret' | |
| }); |
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' ); | |
| const bluebird = require( 'bluebird' ); | |
| // our token validation service - promisified | |
| const tokenValidator = bluebird.promisifyAll( require( './lib/token-validator' ) ); | |
| // our nosql datastore - promisified |
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' ); | |
| const bluebird = require( 'bluebird' ); | |
| // our token validation service - promisified | |
| const tokenValidator = bluebird.promisifyAll( require( './lib/token-validator' ) ); | |
| // our nosql datastore - promisified |
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 redis = require( 'redis' ); | |
| exports.handler = function( event, context, callback ) { | |
| callback( null, 'ok' ); | |
| }; |
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'; | |
| exports.handler = function( event, context, callback ) { | |
| callback( null, 'ok' ); | |
| }; |
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
| const redis = require( 'redis' ); | |
| const bluebird = require( 'bluebird' ); | |
| bluebird.promisifyAll(redis.RedisClient.prototype); | |
| bluebird.promisifyAll(redis.Multi.prototype); |