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

openapi-node-function-template

v1.6.1

Published

OpenAPI 3 Node function template for easy Microservices and Serverless platform development

Downloads

41

Readme

OpenAPI 3 function template

Build Status OpenFaaS OpenAPInpm version npm downloads

Do you want to build a microservice based on OpenAPI 3 specification? Do you hate writing all the boilerplate endpoint code? Or do you need your neat serverless function? Running on OpenFaaS or another serverless provider?

You came to the right place.

OpenAPI Node Function Template is a single dependency along your OpenAPI 3 specification file you actually need in order to run your service!

  • :white_check_mark: generated OpenAPI 3 REST endpoint
  • :white_check_mark: validated inputs based on the provided schemas
  • :white_check_mark: flexible middlewares
  • :white_check_mark: follows OpenFaaS template but it is not bound to it
  • :white_check_mark: running as standalone NodeJS server
  • :white_check_mark: works on top of Express
  • :white_check_mark: uses fantastic OpenAPI Backend project

Release notes

1.6.1

  • make previous change defensive

1.6.0

  • exposed ability to exclude or obscure headers from logging

1.5.1

  • version fix of 1.5.0

1.5.0

  • passing request fields from OpenAPI Backend Context as part of FunctionEvent
  • passing also raw Context if necessary
  • documented FunctionEvent

1.4.0

1.3.0

  • support for flexible middleware injections

1.2.0

  • upgraded OpenAPI Backend to 2.3.0

Operation handler

Your operation handler for an endpoint looks like this:

export default async (message, context) => {
  context.status(200).succeed({ "nice": "json" });
}

Where message is of type FunctionEvent and context is of type FunctionContext.

Environment configuration

| Variable | Default value | Description | |-------------------------------|---------------------|---------------------------------------------------------| | NODE_ENV | | | | SSL | false | | | http__port | 4000 | | | http__request_id_header | X-Request-Id | | | http__ssl__key_file | $(cwd)/ca/key.pem | | | http__ssl__cert_file | $(cwd)/ca/cert.pem | | | openapi__single_operation_id | singleHandler | | | openapi__filename | | | | openapi__url | | | | service__namespace | default-ns | | | request__body__size | 1mb | | | logger__name | defaultLogger | | | logger__level | info | | | logger__excluded_headers | authorization,token | comma separated list of headers to exclude from logging | | logger__obscured_headers | authorization,token | comma separated list of headers to obscure in logging |

Examples

Develop

Prepare .npmrc

Create .npmrc in the root:

save-exact=true
prefix=/home/developer/.npm-global

Use Docker for development

docker-compose up -d dev docker-compose exec dev zsh

Publish

npm login registry.npmjs.org npm publish