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

@shrynery/framework

v0.1.0

Published

The Shrynery framework package.

Downloads

5

Readme

SHRYNERY

On Request

  • Keep track of the following
    • The request method.
    • The request path.
    • The client ip.
    • The request payload.
    • The request headers.
  • Convert the request method to lower case.
  • Remove repeating slashes from the request path.
  • Extract the query parameters from the request path.
  • Parse the request payload.
  • Register all primary dependences
    • Configuration
    • Router
  • Create all primary dependency instances
  • Register all middleware defined in the config files to the router depenency instance.
  • Register all providers defined in the config files.
  • Boot all providers defined in the config files.
  • Resolve the request.
    • Run all global middleware.
    • Find the route that matches with the request path.
    • Run all middleware groups associated with the route.
    • Run all lone middleware associated with the route.
    • If any middleware resolves, return the result as response; else, return the resolved route action as response.

Middleware

  • Middleware can be functions or classes that extend the core/Middleware class.
    • As a function, when called, 2 arguments will be passed.
      • The request
      • The next callback
    • As a class, the will be an invoke method which will be called when the middleware is encounted; and the arguments described above will be passed to said function.
  • All middleware are defined in the config/app.js file.
  • There are 3 types of middleware
    • Global middleware – runs everytime a request is made.
    • Grouped middleware – contains a set of middleware which run only if assigned to a matching route.
    • Lone middleware – runs only if assigned to a matching route.
  • Group and Lone middleware are defined as key-middleware pairs.
  • Middleware can be assigned to routes by using their definition keys.

Routes

  • Routes are used to identify what logic to run given some method and path.
  • All active routes must be register to the router in order to work.
  • To register a route, you'll need to specify the following.
    • path - A string that will be coverted to the regex for request resolution.
    • methods - An array of methods to be compared to during resolution.
    • action - A function that will be run to finalize the resolution.
    • middleware (optional) - An array of middleware that are run before the action during resolution.
    • name (optional) - A tag to reference the route by.
  • Route parameters can be described in the routes path during registration and definition.
  • Bindings – functions that transform route parameter values – can also be registered to each route.