-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Use platform types vs our own. Hook up NP via kbnServer.newPlatform. #39824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,21 +4,14 @@ | |
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { ServerRoute } from '../common/types'; | ||
| import { HttpServiceSetup, CoreStart } from 'src/core/server'; | ||
| import { fetchList } from './registry'; | ||
| import { routes } from './routes'; | ||
|
|
||
| export interface CoreSetup { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also pull in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| http: HttpServiceSetup; | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
| export interface CoreStart {} | ||
|
|
||
| export interface HttpServiceSetup { | ||
| route(route: ServerRoute | ServerRoute[]): void; | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
| export interface PluginInitializerContext {} | ||
|
|
||
|
|
@@ -28,11 +21,12 @@ export type PluginStart = ReturnType<Plugin['start']>; | |
| export class Plugin { | ||
| constructor(initializerContext: PluginInitializerContext) {} | ||
| public setup(core: CoreSetup) { | ||
| const { route } = core.http; | ||
| const { server } = core.http; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a reminder that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| // map routes to handlers | ||
| routes.forEach(route); | ||
| routes.forEach(route => server.route(route)); | ||
|
|
||
| // the JS API for other consumers | ||
| return { | ||
| getList: fetchList, | ||
| }; | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 now you're using the actual new platform instead of approximating it with a shim.