0.3.0 • Published 10 months ago

@yikesable/fastify-organization-routes v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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

0.3.0

10 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago