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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@techjs/http

v1.0.1

Published

Http | TechJS

Downloads

7

Readme

Http | TechJS

The TypeScript REST framework build on the TechJS core library.

Installation

This is a TypeScript module available through NPM.

$ npm install --save @techjs/http

System Dependencies

About

The TechJS framework aims to provide a structured input event listener pattern by enforcing the principle of separation of concerns. The result is a clearly defined routes, controllers, and services. Through the power of object oriented programming, the @techjs/core library can be extended to provide a familiar interface between HTTP events and other application-layer input protocols, like event bus messages.

Getting Started

You wil need to start by setting up a basic TypeScript project. Initialize npm. Create a tsconfig.json file and configure it as you see fit. You will also need to install the following modules:

  • @techjs/core
  • @techjs/http
  • @techjs/cors
  • @types/express
  • cors
  • express
  • tsnode-di
  • typescript

Create this basic directory structure (UNIX)

$ mkdir -p src/{services,controllers}

Once the project is setup and the directory structure is build, continue by creating a ping service

// src/services/ping-service.ts

export class PingService {
  public async ping(): Promise<string> {
    return "Pong";
  }
}

Now create a ping controller

// src/controllers/ping.controller.ts

import { HttpController } from "@techjs/http";
import { Resolve } from "tsnode-di";
import { PingService } from "../services/ping-service";

export class PingController extends HttpController {
  @Resolve(PingService)
  private ping_service!: PingService;
  public async ping(): Promise<void> {
    try {
      const response: string = await this.ping_service.ping();
      this.res.send(response);
    } catch (e) {
      console.error(e);
      this.res.sendStatus(500);
    }
  }
}

Add a routes file with a /ping route

// src/routes.ts

import { HttpRoute } from "@techjs/http";

// controllers

import { PingController } from "./controllers/ping.controller";

// routes

export const routes: Array<HttpRoute<any>> = [
  new HttpRoute("/ping", "get", PingController, "ping"),
];

And create an entry point

import { HttpRouter } from '@techjs/http';
import * as express from 'express';
import * as cors from 'cors';
import { routes } from './routes';

// create an express app
const app = express();

// add your express middleware here
app.use(cors());

// initialize a TechJS HttpRouter instance
// with your routes and pass the express
// instance
const router = new HttpRouter(routes);
router.init(app);

// bind the express instance to a port
app.listen(3000);

Your project structure should look, at a minimum, like this

.
├── package.json
├── src
│   ├── controllers
│   │   └── ping.controller.ts
│   ├── index.ts
│   ├── routes.ts
│   └── services
│       └── ping-service.ts
└── tsconfig.json

Use TypeScript to transpile this into Node, and then run it. You should have an application running on port 3000 that responds to GET requests on the /ping route with a "Pong" response.