[Enterprise Search] Refactor product server route registrations to their own files/folders#82663
Conversation
- super basic, leaves out assertions to avoid brittleness
| export function registerGroupRoutes(dependencies: IRouteDependencies) { | ||
| registerGroupsRoute(dependencies); | ||
| registerSearchGroupsRoute(dependencies); | ||
| registerGroupRoute(dependencies); |
There was a problem hiding this comment.
@scottybollinger I wasn't sure if you wanted to move all these registrations to the new index.ts or keep them grouped in this file for simplicity - let me know if you have a preference and I can make that change in this PR
There was a problem hiding this comment.
Moving it is fine. Thanks! Will definitely have an effect on #82669 but I can make changes after we merge this or vice versa.
There was a problem hiding this comment.
Sweet, thanks Scotty! I'll move them here shortly.
There was a problem hiding this comment.
Moved in ac5ddaa - hope I got it right, feel free to tweak further in #82669 if I didn't
| import { registerAppSearchRoutes } from './'; | ||
|
|
||
| describe('registerAppSearchRoutes', () => { | ||
| it('runs without errors', () => { |
There was a problem hiding this comment.
I def know these aren't great tests - it basically just confirms that the parent fn runs w/o assertions, which is not my favorite but in this case I'm not sure it's worth the LOE to expand them further since:
- we weren't testing route registration calls originally anyway in plugin.ts
- In theory each individual
registerXRouteshould have its own fleshed out unit testing in any case
scottybollinger
left a comment
There was a problem hiding this comment.
LGTM! Thanks for doing this!
💚 Build SucceededMetrics [docs]distributable file count
History
To update your PR or re-run it, just comment with: |
…eir own files/folders (elastic#82663) * Refactor all AS & WS route registrations to their own file/folders * Remove WS in route registrations since the main fn is already specific * Cover index.ts files - super basic, leaves out assertions to avoid brittleness * Move WS group routes to index.ts
* master: (127 commits) [ILM] Fix breadcrumbs (elastic#82594) [UX]Swap env filter with percentile (elastic#82246) Add platform's missing READMEs (elastic#82268) [Discover] Adding uiMetric to track Visualize link click (elastic#82344) [Search] Add used index pattern name to the search agg error field (elastic#82604) improve client-side SO client get pooling (elastic#82603) [Security Solution] Unskips Overview tests (elastic#82459) Embeddables/migrations (elastic#82296) [Enterprise Search] Refactor product server route registrations to their own files/folders (elastic#82663) Moving reinstall function outside of promise.all (elastic#82672) Load choropleth layer correctly (elastic#82628) Master backport elastic#81233 (elastic#82642) [Fleet] Allow snake cased Kibana assets (elastic#77515) Reduce saved objects authorization checks (elastic#82204) [data.search] Add request handler context and asScoped pattern (elastic#80775) [ML] Fixes formatting of fields in index data visualizer (elastic#82593) Usage collector readme (elastic#82548) [Lens] Visualization validation and better error messages (elastic#81439) [ML] Add annotation markers to time series brush area to indicate annotations exist outside of selected range (elastic#81490) chore(NA): install microdnf in UBI docker build only (elastic#82611) ...
Summary
I was adding a new Engine server route to App Search and noticed our
server/plugin.tswas getting a little bloated/unwieldy. I decided to refactor/move all App Search and Workplace Search server route registrations to their own individual files (e.g.server/routes/index.ts) rather than being at the top level ofserver/plugin.ts.Benefits:
Checklist