All Projects → suddi → claudia-local-api

suddi / claudia-local-api

Licence: MIT license
Command line utility to launch Express local API for claudia-api-builder. Test drive your lambda functions before deployment (https://www.npmjs.com/package/claudia-local-api)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to claudia-local-api

leto-serverless
Angular server(less) side rendering
Stars: ✭ 13 (-13.33%)
Mutual labels:  lambda
telegram-stepfunctions-bot
Serverless Telegram bot made on 4 AWS Lambda chained by AWS Step Functions. All of this written on Serverless Framework using plugins.
Stars: ✭ 26 (+73.33%)
Mutual labels:  lambda
sqs-to-lambda-async
Process SQS messages with Lambda, asynchronously
Stars: ✭ 27 (+80%)
Mutual labels:  lambda
serverless-media-portal
Ready-to-deploy webapp for sharing home videos: a React frontend with a AWS Lambda backend using FFmpeg to process videos. Created using Serverless Framework.
Stars: ✭ 90 (+500%)
Mutual labels:  lambda
terraform-aws-lambda-auto-package
A terraform module to define a lambda function which source files are automatically built and packaged for lambda deployment.
Stars: ✭ 23 (+53.33%)
Mutual labels:  lambda
eksutil
Sample project to call Kubernetes API of an Amazon EKS cluster from AWS Lambda
Stars: ✭ 26 (+73.33%)
Mutual labels:  lambda
GoblinDB
Fear the Goblin! - An amazing, simple and fun database for humans
Stars: ✭ 54 (+260%)
Mutual labels:  lambda
s3-db
Document DB API for AWS S3
Stars: ✭ 97 (+546.67%)
Mutual labels:  lambda
terraform-aws-lambda
A Terraform module to create AWS Lambda ressources.
Stars: ✭ 40 (+166.67%)
Mutual labels:  lambda
guitarteacher
Guitar Teacher skill for the Amazon Alexa platform
Stars: ✭ 16 (+6.67%)
Mutual labels:  lambda
aws-turn-off-my-account
📦 🚀 📦 Lambda stack to turn off and destroy all resources from your personal AWS Account to avoid billing surprises
Stars: ✭ 63 (+320%)
Mutual labels:  lambda
alexa-skill-boilerplate
An easy to use Amazon Alexa Skill Boilerplate for fast skill creation
Stars: ✭ 54 (+260%)
Mutual labels:  claudiajs
serverless-aws-rust-http
⚡🏗️ template for new aws lambda serverless rust http apps
Stars: ✭ 85 (+466.67%)
Mutual labels:  lambda
ecs-drain-lambda
Automation of Draining ECS instances with Lambda, based on Autoscaling Group Lifecycle hooks or Spot Instance Interruption Notices
Stars: ✭ 56 (+273.33%)
Mutual labels:  lambda
fn.el
Concise anonymous functions for Emacs Lisp
Stars: ✭ 26 (+73.33%)
Mutual labels:  lambda
serverless-apollo-datasource-redis
Serverless Apollo Server 2 with cached Datasource in Redis
Stars: ✭ 26 (+73.33%)
Mutual labels:  lambda
lambda-acm-validate
Automatically validate ACM requests with Lambda
Stars: ✭ 34 (+126.67%)
Mutual labels:  lambda
iopipe-java
AWS Lambda telemetry for Java
Stars: ✭ 17 (+13.33%)
Mutual labels:  lambda
raven-python-lambda
Sentry/Raven SDK Integration For AWS Lambda (python) and Serverless
Stars: ✭ 48 (+220%)
Mutual labels:  lambda
SecretsManagerwithCloudFormation
Implements a Lambda-backed CloudFormation Custom Resource for AWS Secrets Manager
Stars: ✭ 20 (+33.33%)
Mutual labels:  lambda

claudia-local-api

CircleCI codecov Codacy Badge npm npm David David license

codecov

Command line utility to launch Express local API for claudia-api-builder. Test drive your lambda functions before deployment

npm install --save-dev claudia-local-api

To install globally:

npm install --global claudia-local-api

Usage

If you have a claudia and claudia-api-builder app/server named lib/app.js ready for deployment and you want to test it locally:

'use strict';

const ApiBuilder = require('claudia-api-builder');

function handleGetRequest(app, req) {
    const body = {
        status: 'OK',
        body: req.body,
        pathParams: req.pathParams,
        query: req.queryString
    };
    return new app.ApiResponse(body, {
        called: 'handleGetRequest'
    }, 200);
}

function handlePostRequest(app, req) {
    const body = {
        status: 'OK',
        body: req.body,
        pathParams: req.pathParams,
        query: req.queryString
    };
    return new app.ApiResponse(body, {
        called: 'handlePostRequest'
    }, 201);
}

function bootstrap() {
    const app = new ApiBuilder();

    app.get('/', handleGetRequest.bind(null, app));
    app.post('/', handlePostRequest.bind(null, app));

    app.get('/users/{id}', handleGetRequest.bind(null, app));
    app.get('/items/{itemId}/{partId}', handleGetRequest.bind(null, app));

    app.post('/objects', handlePostRequest.bind(null, app));

    return app;
}

module.exports = bootstrap()

You can install claudia-local-api and run the command line Express API to test out the lambda function locally:

claudia-local-api --api-module lib/app.js

Or add into your package.json:

"server": "claudia-local-api --api-module lib/app.js"

This will start up a local Express server on port 3000 to proxy requests to your claudia-api-builder app.

You can also pipe it into bunyan to pretty print the log:

claudia-local-api --api-module lib/app.js | bunyan --output short

For full list of options:

claudia-local-api --help
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].