Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Migrate CDS Hooks + Rest modules to fastify-plugin architecture #86

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

jdjkelly
Copy link
Member

@jdjkelly jdjkelly commented Sep 22, 2021

  • Replace 'mount' interface/default export on CDS Hooks and Rest API modules with fastify-plugins
  • Deprecate Config
  • Deprecate Http module
  • Rename several of the objects in the CDS Hooks namespace so they are prefixed with CDS
  • Split fixture servers

This PR doesn't really change how the library is used, but it will require small example changes at the very top level where CDSHooks(config, http) is passed - that changes. And instead of using Http - you use Fastify directly (not a big difference). It's really minor for the end user.

Reviewers should complete this short tutorial with Fastify (https://www.fastify.io/docs/latest/Getting-Started/)

New CDS Example:

import {
  CDSHooks,
} from "../../src"

import patientViewExample from "../cds-hooks/patient-view";
import Http from "fastify";

const pluginConfig = {
  services: [
    patientViewExample,
  ],
  cors: true
}

export const http = Http();

http.register(CDSHooks, pluginConfig)

Merge checklist

- Deprecate Config
- Deprecate Http module
- Replace 'mount' interface/default export on CDS Hooks and Rest API modules with fastify-plugins
- Rename several of the objects in the CDS Hooks namespace so they are prefixed with CDS
- Split fixture servers
@jdjkelly
Copy link
Member Author

Oh it does one other very important thing which is a namespace change.

Rename several of the objects in the CDS Hooks namespace so they are prefixed with CDS

This will break examples - you have to change the import paths. I changed the CDS exports to namespace prefix them with CDS so that it matches what the SmartAuth module does

Copy link
Contributor

@mseckykoebel mseckykoebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I will change the examples to work with these new changes and make a new PR to fit it. I'll also read more into exactly what this does.

@jdjkelly jdjkelly merged commit a21843f into master Sep 22, 2021
@jdjkelly jdjkelly deleted the feature/fastify-plugin-architecture branch September 22, 2021 16:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants