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

syncup-express-routing

v1.2.97

Published

Library to automatically bootstrap a full express application using typescript decorators.

Readme

ExpressDecorators

This project is trying to achieve to provide Angular-like annotations for using the express framework.

ToDo

  • ErrorHandling

Featurelist

This is a list of all features that will be implemented.

Dependency Injection

  • Mark a class as @Injectable() to make it accessable to any other managed class.
  • A managed class can be anything, controllers, middlewares or even the server.
  • If a class is not a anything of the above three, it needs to be defined as a provider in the module it is needed.
  • If an injectable class has dependencies on other injectable classes, it will be inject using the constructor.
@Injectable()
export class ExampleInjectableService {

    public getSomeData(): Observable<Data> {
        return ["Hello World"];
    }
}

Modules

  • A module should be able to define everything related to the application (Controllers, Middlewares).
  • A module defines everything all of its controllers and middlewares need.

Example:

@Module({
    controllers: [
        ExampleController
    ],
    middlewares: [
        ExampleMiddleware
    ],
    providers: [
        ExampleInjectableService
    ]
})
export class ExampleModule {}

Server

  • The server should be able to mount 1 to n modules.
  • It defines on which port it runs.
  • Middlewares should be able to be attached.
@Server({
    port: 8080,
    middlewares: [
        BodyParser,
        CORS
    ],
    imports: [
        ExampleModule
    ],
    providers: [
        AuthenticationService
    ]
})
export class ExampleServer {}

Controller

  • A controller can define functions for a specific routes that handle the request.
  • Middlewares should be able to be applied to the controller or controller function.
  • Mark functions as Get, Post, Put or Delete to make them resolve to a URI.
  • A controller function should be able to have middlewares.
@Controller({
    path: '/exmaplepath',
    middlewares: [
        Authorized
    ]
})
export class ExampleController {

    constructor(private exampleInjectableService: ExampleInjectableService) {}

    @Get({
        path: '/{id}',
        middlewares: []
    })
    public getExampleData(@ResponseParam() response: Response, @PathVariable id: number) {
        this.exampleInjectableService.getExampleData().subscribe(data => response.send(data));
    }
}

Middleware

  • A middleware should intercept a request to a resource and decide to weather or not the request shall be passed on.
@Middleware()
export class ExampleMiddleware {

    constructor(private authorizationService: AuthorizationService) {}

    public onRequest(@ResponseParam response: Response, @Next next: NextFunction) {
        this.authorizationService.isAuthorized(token).subscribe(authorized => {
            if (authorized) {
                next()
            } else {
                response.sendStatus(401);
            }
        });
    }
}

App

@App({
    bootstrap: [ExampleServer]
})
export class ExampleApp extends ExpressApp {}

const exampleApp = new ExampleApp()
exampleApp.start((server) => {
    console.log("Application is running on port: " + server.port);
}, (error) => {
    console.log("Error: Could not start application.", error);
})