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

spirit

v0.6.1

Published

extensible web library for building applications & frameworks

Downloads

111

Readme

spirit

Modern and functional approach to building web applications.

Build Status Coverage Status Join the chat at https://gitter.im/spirit-js/spirit

Why?

const {adapter} = require("spirit").node
const route = require("spirit-router")
const http = require('http')

const hello = () => "Hello World!"

const greet = (name) => `Hello, ${name}`

const app = route.define([
  route.get("/", hello),
  route.get("/:name", ["name"], greet),
])

http.createServer(adapter(app)).listen(3000)

If we think about a web request in its simplest form, it's basically a function, it takes an input (request) and returns an output (response). So why not write web applications this way?

No more req, res. Spirit simplifies everything by abstracting away the complexity of req and res that normally resulted in impure and complex functions.

Middleware in spirit can also transform the returned response and not just the request. This is in contrast to other web libraries that can only transform the request. This is a simple idea but having this feature allows for much more DRY and expressive code.

Given the above, it's much more easier to re-use, test, and reason about your code in spirit.

Oh yea, most Express middleware works in spirit too!

Getting Started

The Handbook

Components

  • spirit is a small library for composing functions and creating abstractions. Abstractions are defined in a "spirit adapter". Currently it comes with 1 builtin, the node adapter (spirit.node) for use with node.js' http module. Eventually there will be another one written for spirit to run in the browser.

  • spirit-router is a library for routing and creating routes.

  • spirit-common is a library that provides many common http related middleware. It's purpose is to make bootstrapping a multitude of middleware that everyone will need easier.

  • spirit-express, is a library for converting most Express middleware to work in spirit.

Third Party Components

  • spirit-body is a simple body parser middleware for spirit. Alternative to using spirit-common which wraps the Express body-parser module.

Contributing

All contributions are appreciated and welcomed.

For backwards incompatible changes, or large changes, it would be best if you opened an issue before hand to outline your plans (to avoid conflict later on).

This codebase avoids using unnecessary semi-colons, camelCase and one-liners.

To run tests, use make test. This will also build changes to src/*, if you do not have make installed, you can look at the Makefile to see the steps to accomplish the task.

Credits

Spirit is heavily influenced by the design of Ring.