Skip to content
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

Feature/refactor server router #290

Merged
merged 8 commits into from
Apr 23, 2021
Merged

Conversation

just-at-uber
Copy link
Contributor

@just-at-uber just-at-uber commented Apr 23, 2021

This PR has no functional change, only syntax / readability changes. The goal is to refactor Cadence UI server router so it has separate files for each route handler. This makes it easier to reason about what each handler is doing. Also each handler has no dependency on other handlers so there is no reason why they are in the same file. Because this PR is creating new files, majority of new lines are created from license headers per new file.

Changed

  • moved server/router.js route handlers into separate files in server/router/routes
  • moved server/helpers into server/router/helpers
  • moved helpers in server/router.js toserver/router/helpers

@@ -1,422 +0,0 @@
// Copyright (c) 2017-2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

file moved to server/router/index.js

@@ -0,0 +1,34 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/helpers into server/router/handlers

@@ -0,0 +1,37 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

@just-at-uber just-at-uber Apr 23, 2021

Choose a reason for hiding this comment

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

moved helpers in server/router.js to server/router/handlers

@@ -0,0 +1,46 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved helpers in server/router.js toserver/router/helpers

@@ -0,0 +1,45 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved helpers in server/router.js toserver/router/helpers

@@ -0,0 +1,33 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved helpers in server/router.js toserver/router/helpers

@@ -0,0 +1,136 @@
// Copyright (c) 2017-2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

file moved from server/router.js to server/router/index.js

workflowQueryTypeHandler,
workflowSignalHandler,
workflowTerminateHandler,
} = require('./routes');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,30 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,26 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,31 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,39 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -19,8 +19,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

const momentToLong = require('./moment-to-long');
const healthHandler = ctx => (ctx.body = 'OK');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think git diff messed up here. this is a new route handler.

@@ -0,0 +1,58 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,41 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,31 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,55 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,47 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,46 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,90 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,37 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,33 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,41 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,30 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,28 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@@ -0,0 +1,28 @@
// Copyright (c) 2021 Uber Technologies Inc.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved server/router.js route handlers into separate files in server/router/routes

@just-at-uber just-at-uber marked this pull request as ready for review April 23, 2021 20:25
@just-at-uber just-at-uber requested a review from a team April 23, 2021 20:26
Copy link

@mkolodezny mkolodezny left a comment

Choose a reason for hiding this comment

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

LGTM, the overall structure looks more clear now!

@just-at-uber just-at-uber merged commit 71e1c1f into master Apr 23, 2021
@just-at-uber just-at-uber deleted the feature/refactor-server-router branch April 23, 2021 20:35
@just-at-uber just-at-uber mentioned this pull request May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants