npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aglex

v2.0.0

Published

API Gateway + Lambda + Express development tool

Downloads

16

Readme

aglex

Aglex is a support tool for building serverless web applications using Amazon API Gateway, AWS Lambda and Express.

Build Status Build Status Coverage Status Dependency Status bitHound Code

No more new frameworks for Lambda + API Gateway!

Express is the most famous web framework for Node.js. Now you can use the same way to develop your API Gateway-Lambda web app.

UPDATE: now 2.x uses aws-serverless-express and new config yaml.

Installation

Global install

$ npm install aglex -g

or install and add to current package.

$ npm install aglex --save-dev

Features

Aglex is not a web framework, just a small CLI tool which provides following features.

  • Generate a small lambda handler code
  • Create, update lambda function
  • Add execute-api permission to the function
  • Create, update and deploy API

Quick start

  1. Start your app with express-generator.
$ npm install express-generator -g
$ express myapp
$ cd myapp && npm install
  1. Modify routes/users.js to respond JSON data.
@@ -3,7 +3,7 @@

 /* GET users listing. */
 router.get('/', function(req, res, next) {
-  res.send('respond with a resource');
+  res.json({message: 'respond with a resource'});
 });

 module.exports = router;
  1. Generate config yaml
$ aglex generate config > aglex.yml

Edit it to match your environment.

@@ -18,14 +18,14 @@
   Runtime: nodejs4.3
   MemorySize: 128
   Timeout: 60
-  FunctionName: YOUR_LAMBDA_FUNCTION_NAME
-  Description: YOUR_LAMBDA_DESCRIPTION
-  RoleName: YOUR_LAMBDA_EXECUTION_ROLE # Role ARN will generate from RoleName automatically
+  FunctionName: myapp
+  Description: myapp
+  RoleName: lambda-myapp # Role ARN will generate from RoleName automatically

 ## API Gateway configuration
 apiGateway:
   swagger: 2.0
   info:
-    title: YOUR_API_NAME
-    description: YOUR_API_DESCRIPTION
+    title: myapp
+    description: myapp
   basePath: /prod
   schemes:
     - https
  1. Generate lambda handler code and install aws-serverless-express
$ aglex generate lambda-handler > lambda.js
$ npm install -S aws-serverless-express
  1. Create lambda zip
$ zip -r lambda.zip app.js lambda.js routes views node_modules

Use Gulp/Grunt if you want to do more tasks.

  1. Create/update your lambda function
$ aglex --config aglex.yml lambda update --zip lambda.zip

Create IAM Role for Lambda function lambda-myapp before execution.

  1. Add execute permission to your lambda function (first time only)
$ aglex --config aglex.yml lambda add-permission
  1. Create/update API
$ aglex --config aglex.yml apigateway update
  1. Create stage and deploy API
$ aglex --config aglex.yml apigateway deploy --stage dev

For more information, please see wiki docs.

See Also