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

localhostjs

v1.0.0

Published

A js library to build and deploy websites to localhost in a working manner

Downloads

12

Readme

Localhostjs

Philosophy

Serverless has without a doubt helped deploying apps to the web. However sometimes it's useful to own the infra you're using. This is where we jump in, localhostjs allows you to use the localhost website in combination with working id and secret to deploy your app from a local machine using the expressjs server framework.

Installation

to install just install using npm or your package manager of choice:

npm install localhostjs 

Usage

Currently the framework only allows for http requests (namely GET and POST) but we are working on websockets as well (maybe in 1.0).

HTTP requests

HTTP requests are easily instantiated using express syntax (it is actually exactly the same as we use express to handle http)


const app = require("localhostjs");
const exp = app.express
const path = require("path")
require("dotenv").config();


app.rest.use(exp.static(path.join(__dirname, "static")));


app.socket.on("event", data => {

    processData(data); 


    app.socket.send("event", {...somedata}, [
        data.id, //original sender
        receiver1, 
        receiver2, 
        receiver3, 
    ])

})

app.listen({
        id:process.env.id,
        secret:process.env.secret
}, "http://localhost:5000") 
//leave out url if you connect to localhostjs

Websockets and client lib

To use the websocket functionality you have to use our websocket client lib (the file with cdn in the name...) or simply use the cdn:

<script src="https://cdn.jsdelivr.net/gh/Adotweb/localhostjs/localhost.cdn.js"></script>

in said client lib things behave similar to the socket.send and socket.on function in the server library:


socket.register() //connects to the currently connected url

socket.on("event", data => {

    handleData(data)

})

socket.send("event", {...somedata})