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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tentorium/core

v0.0.5

Published

Create Restful APIs easily with decorative coding. Inspired by Spring-Boot

Downloads

6

Readme

Tentorium

This is a javascript library that provides similar functionality of SpringBoot. Read more about SpringBoot here.

This library can be used to create Restful APIs easily with decorative coding.

Features provided:

  • Annotation based components creation (e.g @RestController('/users') )
  • Dependency Injection (e.g. @InjectArgument('beanName') someBean: TypeOfBean;)

Usage

Creating an application

import Core from "@tentorium/core";
import UserController from "./controllers/UserController";
import "reflect-metadata";

const { ExpressApplication, InjectArgument } = Core;

@ExpressApplication()
class Application {
  @InjectArgument("NodeSpringApplication") nodeSpringApplication: any;

  // register all the controllers of our application
  @InjectArgument("UserController") userController: UserController;

  constructor() {
    this.nodeSpringApplication.run();
  }
}

Defining New Routes

Routes can reginstered using @RestController class decorator. The methods inside of a controller class can be decorated using different request method decorators. For example @GetRequest would create a get request.

Request object can be extracted using @RequestParams, @QueryParams decorators. Complete example of a controller is shown below:

import Core from "@tentorium/core";

const {
  Component,
  InternalServerError,
  GetRequest,
  RequestParam,
  RestController,
} = Core;

@RestController("/users")
@Component({}) //todo make restcontroller automatically be component
class UserController {
  @GetRequest("/")
  static getUsers(req) {
    return {
      users: [
        {
          name: "upen dhakal",
          email: "[email protected]",
        },
      ],
    };
  }

  @PostRequest("/")
  static createNewUser(@RequestBody() createUserRequestBody) {
    return createUserRequestBody;
  }
}

export default UserController;

Request method decorators

@Request method decorator can be used to mark a controller's method as a http request handler. This decorator can be used to make any type of http request.

More specific method decorators availavle are: @GetRequest, @PostRequest (More to add..).

Extracting Path Parameters

@RequestParam decorator can be used to extract path parameter from the request. Make sure the path has :<some-path-key> to be able to use this decorator.

For example for a route defined as @GetRequest("/users/:userId"), if user makes request to /users/1234 and the method has an argument @RequestParam("userId") userId, the variable userId will have value of 1234.

Full example of a rquest extracting path parameter is:

@GetRequest("/:userId")
static getUser(@RequestParam("userId") userId: string) {
    console.log("Request parameter recieved is ", userId;
    return {
        name: "upen dhakal",
        userId,
        email: "[email protected]",
    };
}

Extracting Query Parameters

Similar to Path Parameters, query parameters can be extracted with @QueryParam decorator as shown below:

@GetRequest("/:userId")
static getUser(@RequestParam("userId") userId: string, @QueryParam("postId") postId: string): User {
    console.log("Request parameter recieved is ", userId);
    console.log("Query parameter recieved is ", postId);
    return {
        name: "upen dhakal",
        userId,
        postId,
        email: "[email protected]",
    };
}

making a get request to users/1234?postId=abcd would produce follwing in console:

  Request parameter recieved is 1234
  Query parameter recieved is abcd

Extracting Request Body

@RequestBody decorator can be used to extract the http request's body as shown below:

@PostRequest("/")
static getUsersWithFilter(@RequestBody() parsedBody: object): { users: [User]}  {
    console.log(parsedBody)
    return {
        users: [
            {
                name: "upen dhakal",
                userId: "dummyuser",
                email: "[email protected]",
            }
        ]
    };
}