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

webwebweb

v1.6.1

Published

The Comfiest Way to make web APIs and static file servers

Downloads

55

Readme

WebWebWeb

The zero-dependency alternative to ExpressJS. We built the Comfiest Way to make web APIs and static file servers live on Twitch for Coding Cafe!

WebWebWeb lets you create a web server with APIs SUPER EASILY in just a few lines of code.

If you need a secure web server with SSL certificates from Let's Encrypt, check out WebWebWebs which will automatically retrieve and renew them for you while maintaining the simplicity of WebWebWeb!

Instafluff

Like these projects? The best way to support my open-source projects is by becoming a Comfy Sponsor on GitHub!

https://github.com/sponsors/instafluff

Come and hang out with us at the Comfiest Corner on Twitch!

https://twitch.tv/instafluff

Instructions

  1. Install webwebweb
npm install webwebweb --save
  1. Start the server on a port (e.g. 8099). Any HTML pages (e.g. index.html) can be placed in the root directory / and static files (e.g. images, scripts, and other HTML pages) can go into /web or /public and it will be served automagically in http://locahost:8099/web or http://localhost:8099/public
require( "webwebweb" ).Run( 8099 );
  1. (Optional) Add APIs
var ComfyWeb = require( "webwebweb" );
ComfyWeb.APIs[ "/" ] = ( qs, body, opts ) => {
  return { "test": "example!" };
};
ComfyWeb.Run( 8099 );

Options

The Run() function in WebWebWeb accepts several optional parameters:

  • useCORS (default: true)
  • Certificate
  • PrivateKey
  • CertificateChain

Handling POST/PUT/DELETE requests

All request methods are sent to the API handler. You can check the opts.req.method value to response accordingly and parse the body object for data.

var ComfyWeb = require( "webwebweb" );
ComfyWeb.APIs[ "/account" ] = ( qs, body, opts ) => {
    switch( opts.req.method ) {
        case "GET":
            return { "account": "test" };
        case "POST":
            return JSON.parse( body );
        case "PUT":
            return { "status": "updated" };
        case "DELETE":
            return {};
    }
};
ComfyWeb.Run( 8099 );

Reading Request Headers

The request object is passed in to the API handler. You can check for header values in opts.req.headers.

var ComfyWeb = require( "webwebweb" );
ComfyWeb.APIs[ "/" ] = ( qs, body, opts ) => {
    return opts.req.headers;
};
ComfyWeb.Run( 8099 );

Enabling CORS

Actually, CORS is enabled by default. To disable CORS, set the useCORS parameter:

var ComfyWeb = require( "webwebweb" );
ComfyWeb.Run( 8099, {
    useCORS: false
} );

Using SSL Certificates

To add TLS support, pass in the paths to your Certificate, Key, and Certificate Chain files:

var ComfyWeb = require( "webwebweb" );
ComfyWeb.Run( 8099, {
    Certificate: "cert.pem",
    PrivateKey: "key.pem",
    CertificateChain: "chain.pem"
} );

Credits

Thank you to all the participants of this project!

MacABearMan, Instafriend, That_MS_Gamer, Instafluff, ChatTranslator, sethorizer, simrose4u, Gilokk0, RIKACHET, UltraHal1, SaltPrincessGretchen, Ella_Fint, DutchGamer46, AntiViGames, aj2017, SoundOfGaming, DEAD_P1XL, smilesandtea, MerlinLeWizard, my_sweet_clementine, rockysenpai24, tabetaicooking, sparky_pugwash, violettepanda, TheSkiDragon, radiocaf, LinkoNetwork, jawibae, ElysiaGriffin, DarrnyH, jellydance, DevMerlin, marss112, roberttables, tiger_k1ng, LilyHazel, Psychosys82, BungalowGlow, Stay_Hydrated_Bot, pookiepew, Copperbeardy, TheHugoDahl, wil_bennett, WolvesGamingDen, FuriousFur, SausageCam, Kyoslilmonster, EndlessMoonfall, JD_Hirsch, guthron, shinageeexpress, JMSWRNR, schmiel_show, KitAnnLIVE, space_butts, lukepistachio, pipskidoodle, Kara_Kim, SIeepyMia, itsmechrisg, tapemoose, XandyCTz, Thrennenne, kollecz, Hytheria, YoursTrulyGreed