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

@nullgato/transgress

v0.1.1

Published

Overcomplicated, very opinionated, maximalist web framework

Downloads

7

Readme

Transgress Webserver Framework for Bun

Overcomplicated, very opinionated, maximalist web framework for Bun

This project is entirely typescript and is not meant to be used with JavaScript projects although I'm sure you probably could

Usage

// you can write your own ILogger, but one is provided for you
const loggerOpts = {
    logLevel: OLogLevel.Info,
    intlOptions: {
        locale: 'en-US',
        timezone: 'America/Chicago',
    },
    extraSpacing: false,
}

const logger = new Logger(loggerOpts)

// same with the IMiddleware interface
const middleware = new Middleware(logger)

middleware.register({
    name: 'Middleware Name',
    callback: async (logger: ILogger, req: Request): RouterResponse => {
        return new Response('hewwo', { status: 400 })
    },
    log: (logger: ILogger, data: string | ILogObject): ILogger => {
        return logger
    },
})

const options: ITransgressOptions = {
    development: true,
    // the errorHandler is optional
    errorHandler: (error: Error) => {
        return new Response('rip', { status: 500 })
    },
    middleware,
    port: 12000,
}

const server = transgress(options)
logger.logInfo(`Server initialized and running on port: ${server.port}`)

// Server is now listening for connections

To add websocket handlers, you'll just need to add an object with type WebSocketHandler where T is the data context you'll be using throughout the life of the websocket. This basically consists of open/close/message handlers.

Installation

This is a Bun module available through the npm registry

Before installing, download and install Bun. Unknown which Bun version is required, this was tested with Bun v1.1.24

If this is a brand new project, make sure to create a package.json first with the npm init command

Install using the bun install command:

$ bun install @nullgato/transgress

Run using the bun <script> command:

$ bun index.ts

Features

  • An alright routing system
  • Probably okay performance
  • A middleware system
  • Support for websockets (not really a flex, I'm running out of yays)
  • Support for HTML pages and {{variable}} within them
  • A template for websocket packets via abstract class BasePacket
  • Uhhhhh

Philosophy

"It be what it be, and it do what it do." - me

The project is a serious one, but ultimately this README is a parody of express.js because I'm too tired right now to think of something better