@yikesable/fastify-organization-routes
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Fastify Organization Routes

Organization routes support for Fastify

neostandard javascript style Module type: ESM Types in JS Follow @voxpelli@mastodon.social

Usage

import fastify from 'fastify';

import fastifyOrganizationRoutesPlugin from '@yikesable/fastify-organization-routes';

const app = fastify();

app.register(fastifyOrganizationRoutesPlugin, {
  loadOrganization: async (organizationSlug, { request }) => {
    // Do eg. a database lookup
    if (organizationSlug === 'foo) {
     return { id: 'abc123', slug: 'foo', abc: 123 }
    }
  },
  routes: [
    async fastify => {
      fastify.get('/bar', async () => {
        // Reached by requesting eg. /foo/bar where "foo" is the organization slug
        return 'Hi';
      });
    },
  ],
});

API

TBD

/@yikesable/fastify-organization-routes/

    Package Sidebar

    Install

    npm i @yikesable/fastify-organization-routes

    Weekly Downloads

    13

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    12.4 kB

    Total Files

    12

    Last publish

    Collaborators

    • voxpelli