1.1.0 • Published 20 days ago
@byu-oit/fastify-windrunner v1.1.0
@byu-oit/fastify-windrunner
Blazingly fast server development for BYU OIT
Usage
import Fastify from 'fastify'
import { Type } from '@fastify/type-provider-typebox'
import { ByuLogger } from '@byu-oit/logger'
import OpenApi from '@fastify/swagger'
import OpenApiUi from '@fastify/swagger-ui'
import ByuJwtProvider from '@byu-oit/fastify-jwt'
import { GroAuthorizationProvider } from '@byu-oit/windrunner-authorization-gro'
import { Field } from '@byu-oit/windrunner-contract'
import { PostgreSqlProvider } from '@byu-oit/windrunner-store-pg'
import { Windrunner } from '@byu-oit/fastify-windrunner'
/** Define the resource */
const byuId = Field.from(Type.String()).sortable(false)
const email = Field.from(Type.String())
const resource = { byuId, email }
/** Define options */
const prefix = '/example/v1'
const tableName = 'example'
const groupId = 'example'
/** Server setup */
const fastify = Fastify({ logger: ByuLogger() })
fastify.register(OpenApi, {
swagger: {
openapi: '3.1.0',
info: {
title: 'Example BDP API',
version: '0.0.0'
}
}
})
fastify.register(OpenApiUi, {
routePrefix: '/documentation'
})
fastify.register(ByuJwtProvider, { prefix, issuer: process.env.BYU_OIT_ISSUER, development: process.env.NODE_ENV !== 'production' })
fastify.register(GroAuthorizationProvider, { prefix, groupId })
const db = new PostgreSqlProvider({ tableName })
fastify.register(Windrunner, { prefix, resource, db })
await fastify.listen({ port: 3000 }).catch(err => {
console.error(err)
process.exit(1)
})
1.1.0
20 days ago
1.0.1
2 months ago
0.9.0
2 months ago
0.8.3
2 months ago
0.8.2
3 months ago
0.8.1
4 months ago
0.8.0
5 months ago
0.7.0
5 months ago
0.5.0
5 months ago
0.6.0
5 months ago
0.5.1
5 months ago
0.4.1
6 months ago
0.4.0
6 months ago
0.3.0
7 months ago
0.3.2
7 months ago
0.2.3
10 months ago
0.3.1
7 months ago
0.2.4
8 months ago
0.2.2
11 months ago
0.2.1
12 months ago
0.2.0
12 months ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago