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 🙏

© 2025 – Pkg Stats / Ryan Hefner

serverless-aws-router

v1.3.1

Published

Minimalist serverless router system for Node.JS

Readme

serverless-aws-router

Build Status: Linux Libraries.io dependency status for latest release npm node-current GitHub code size in bytes

This project aims to be a lightweight router system for Serverless framework for AWS Lambda. The code design was inspired on Hapi framework, and try to mimic the routes, validations, requests and response models of traditional NodeJS router frameworks.

Documentation and options

All configuration options, methods, and events can be found on the Wiki section on this repo.

Install

$ npm install serverless-aws-router

Creating a Router Handler

The router handler needs two parts: a serverless.yml that will have the main route configuration, and a server.js that will have the inner endpoints. A very basic example will look like the following:

serverless.yml

service: serverless-social-network

provider:
  name: aws
  runtime: nodejs16.x

functions:
  app:
    handler: server.handler
    events:
      - http:
          path: /
          method: ANY
          cors: true
      - http:
          path: /{proxy+}
          method: ANY
          cors: true

All HTTP endpoints paths and methods, are pointed to the server.handler, which will call the exported method handler at the server.js file.

Server({ options })

'use strict';

const slsRouter = require('serverless-aws-router');
const Joi = require('joi');

const server = new slsRouter.Server({
	Joi, //Required
	joiOptions : { //Optional
		abortEarly: true, //Optional
		allowUnknown: false, //Optional
		cache: true //Optional
	},
	wrapResponse: true, //Optional, default true
	auth : { //Optional
		method: 'jwt', //Default 'jwt'
		function: null //Default null
	},
	parseQueryString: false //Optional, default false (v1.1.0+)
});

server.route({
	method: 'GET',
	path: '/',
	handler: async (request, reply) => {
		return reply.response({ Hello : "World!" });
	}
});

module.exports.handler = (event, context, callback) => server.handler(event, context, callback);

First create a new slsRouter.Server(), then add your routes to the server, and finally export the server.handler() that will receive the serverless requests.

Examples

You can find some usage examples on the test folder on this repo.