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

@danceroutine/tango-adapters-express

v1.10.3

Published

Express adapter for Tango

Readme

@danceroutine/tango-adapters-express

@danceroutine/tango-adapters-express runs Tango views and viewsets inside Express.

Express still owns routing, middleware, request lifecycle, and application bootstrapping. This package connects those Express responsibilities to Tango's framework-agnostic resource layer, filtering, pagination, serializer-backed request and response contracts, and response conventions.

Install

pnpm add @danceroutine/tango-adapters-express express

In a real application you will usually install this alongside the Tango packages that define your models, serializers, and resource classes.

How it fits into an Express application

A typical Tango + Express stack looks like this:

  1. define models with @danceroutine/tango-schema
  2. query and mutate data through Model.objects from @danceroutine/tango-orm
  3. define serializer-backed resource behavior with @danceroutine/tango-resources
  4. use ExpressAdapter to register those handlers with Express routes

The adapter's responsibility is restricted to translating between Express request handlers and Tango's framework-agnostic view and viewset interfaces, then handing the resulting response back to Express.

Quick start

import express from 'express';
import { z } from 'zod';
import '@danceroutine/tango-orm/runtime';
import { ExpressAdapter } from '@danceroutine/tango-adapters-express/adapter';
import { Model, t } from '@danceroutine/tango-schema';
import { ModelSerializer, ModelViewSet } from '@danceroutine/tango-resources';

const TodoReadSchema = z.object({
    id: z.number(),
    title: z.string(),
    completed: z.boolean(),
});

const TodoCreateSchema = TodoReadSchema.omit({ id: true });
const TodoUpdateSchema = TodoCreateSchema.partial();

type Todo = z.infer<typeof TodoReadSchema>;

const TodoModel = Model({
    namespace: 'app',
    name: 'Todo',
    schema: TodoReadSchema.extend({
        id: t.primaryKey(z.number().int()),
        title: z.string(),
        completed: t.default(z.boolean(), 'false'),
    }),
});

class TodoSerializer extends ModelSerializer<
    Todo,
    typeof TodoCreateSchema,
    typeof TodoUpdateSchema,
    typeof TodoReadSchema
> {
    static readonly model = TodoModel;
    static readonly createSchema = TodoCreateSchema;
    static readonly updateSchema = TodoUpdateSchema;
    static readonly outputSchema = TodoReadSchema;
}

class TodoViewSet extends ModelViewSet<Todo, typeof TodoSerializer> {
    constructor() {
        super({
            serializer: TodoSerializer,
            orderingFields: ['id', 'title'],
        });
    }
}

async function main(): Promise<void> {
    const app = express();
    app.use(express.json());

    const viewset = new TodoViewSet();
    const adapter = new ExpressAdapter();

    adapter.registerViewSet(app, '/api/todos', viewset);
}

registerViewSet(...) is the application-facing CRUD helper. It registers collection routes at /api/todos and detail routes at /api/todos/:id, then calls list, create, retrieve, update, and destroy on the viewset instance as requests come in.

ExpressAdapter also exposes toQueryParams(req) for application code that wants the same normalized query contract resources use internally. That helper returns TangoQueryParams from @danceroutine/tango-core and stays focused on Express-to-Tango normalization.

Public API

The root export includes:

  • ExpressAdapter, the main integration class
  • AdaptExpressOptions, for adapter configuration
  • route-facing helper types such as ExpressAPIView, ExpressCrudViewSet, and ExpressRouteRegistrar

You can import from the package root or from the adapter subpath:

import { ExpressAdapter } from '@danceroutine/tango-adapters-express';
import { adapter } from '@danceroutine/tango-adapters-express';

Documentation

The official documentation walks through Tango from first principles and gives the clearest starting point when you are evaluating the framework or building with it.

Development

pnpm --filter @danceroutine/tango-adapters-express build
pnpm --filter @danceroutine/tango-adapters-express typecheck
pnpm --filter @danceroutine/tango-adapters-express test

For the wider contributor workflow, use:

License

MIT