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

remove api prefix from routes #280

Merged

Conversation

formsdev
Copy link
Collaborator

@formsdev formsdev commented Jan 5, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced user experience with updated URL structures for API interactions.
    • Streamlined form creation and management with revised endpoint integrations.
    • Added direct access to stats and monitoring tools with new external links.
  • Bug Fixes

    • Fixed image display issues by adjusting image width in the QR code component.
  • Refactor

    • Simplified API route definitions for better maintainability and readability.
    • Updated CORS configuration to allow requests from all paths, enhancing API accessibility.
  • Documentation

    • Updated internal documentation to reflect changes in route handling and endpoint usage.
  • Style

    • Enhanced visual styling for the search bar to align with the application's design language.
  • Chores

    • Removed unused code and properties to declutter and optimize the codebase.

@formsdev formsdev requested a review from JhumanJ January 5, 2024 14:04
Copy link
Contributor

coderabbitai bot commented Jan 5, 2024

Walkthrough

The overall change involves a reconfiguration of API routing and CORS settings, alongside updates to client-side components and pages. API routes are now defined without a specific 'api' prefix and apply middleware directly. CORS policy has been broadened to include all paths. Client-side updates reflect these routing changes, with endpoints adjusted accordingly. Additionally, there's a shift in handling certain server routes like Stripe and Vapor webhooks, file uploads, and certificate serving, which are now present in the API routes file.

Changes

File(s) Change Summary
app/Providers/RouteServiceProvider.php
client/components/.../ForgotPasswordModal.vue
client/components/.../CreateFormBaseModal.vue
client/pages/auth/password/email.vue
client/pages/auth/password/reset.vue
client/pages/forms/[slug]/show.vue
Removed prefix('api') and applied middleware('api') directly to routes. Updated endpoint URLs to reflect removal of '/api' prefix.
client/components/.../FormSubmissions.vue Added runtimeConfig for dynamic URL generation.
client/components/.../FormQrCode.vue Added the w-56 class to the NuxtImg component's src attribute.
client/components/.../RegenerateFormLink.vue Updated the endpoint URL used for form-related API requests.
client/pages/settings/admin.vue Added dynamic URL generation for external links using runtimeConfig.
config/cors.php Modified CORS paths setting from ['api/*'] to ['*'].
routes/api.php Added new imports and routes for webhooks, file uploads, and certificate handling.
routes/web.php Removed certain route declarations, added Illuminate\Http\Response import.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 27ece34 and 062e38c.
Files selected for processing (13)
  • app/Providers/RouteServiceProvider.php (1 hunks)
  • client/components/open/forms/components/FormSubmissions.vue (2 hunks)
  • client/components/pages/auth/ForgotPasswordModal.vue (1 hunks)
  • client/components/pages/forms/create/CreateFormBaseModal.vue (1 hunks)
  • client/components/pages/forms/show/FormQrCode.vue (1 hunks)
  • client/components/pages/forms/show/RegenerateFormLink.vue (1 hunks)
  • client/pages/auth/password/email.vue (1 hunks)
  • client/pages/auth/password/reset.vue (1 hunks)
  • client/pages/forms/[slug]/show.vue (1 hunks)
  • client/pages/settings/admin.vue (2 hunks)
  • config/cors.php (1 hunks)
  • routes/api.php (2 hunks)
  • routes/web.php (2 hunks)
Files skipped from review due to trivial changes (4)
  • client/components/pages/auth/ForgotPasswordModal.vue
  • client/components/pages/forms/show/FormQrCode.vue
  • client/pages/auth/password/reset.vue
  • client/pages/forms/[slug]/show.vue
Additional comments: 13
config/cors.php (1)
  • 18-18: The CORS paths configuration has been changed to allow all paths. Confirm that this broadening of the CORS policy is intentional and that appropriate security measures are in place to protect against potential cross-origin attacks.
client/pages/auth/password/email.vue (1)
  • 45-45: The endpoint URL in the send method has been updated to remove the /api prefix, which is consistent with the PR's objective to refactor the routing system.
app/Providers/RouteServiceProvider.php (1)
  • 43-45: The route declaration in the boot method has been modified to remove the prefix('api') and apply only the middleware('api'), which aligns with the PR's objective to remove the 'api' prefix from routes.
client/pages/settings/admin.vue (1)
  • 57-58: The URLs for stats and horizon pages are now generated using runtimeConfig, which reflects the removal of the 'api' prefix and is consistent with the PR's objective.
client/components/pages/forms/show/RegenerateFormLink.vue (1)
  • 98-98: The formEndpoint computed property has been updated to remove the /api prefix, which is consistent with the PR's objective to refactor the routing system.
client/components/pages/forms/create/CreateFormBaseModal.vue (1)
  • 123-123: The endpoint URL in the generateForm method has been updated to remove the /api prefix, which is consistent with the PR's objective to refactor the routing system.
client/components/open/forms/components/FormSubmissions.vue (1)
  • 104-105: The addition of runtimeConfig to the returned object in the setup function and the modification of the exportUrl method to use runtimeConfig.public.apiBase are consistent with the PR's objective.
routes/api.php (6)
  • 21-23: New imports for Illuminate\Http\Request, Illuminate\Http\Response, and Illuminate\Support\Facades\Storage have been added. Verify that these imports are used in the routes defined in this file and that their addition is intentional.

  • 187-189: A new route for handling Stripe webhooks has been added. Ensure that the webhook handling is secure and that the handleWebhook method properly validates and processes the incoming webhook requests.

  • 192-194: A new route for handling Vapor signed storage URLs has been added. Confirm that the middleware applied to this route is appropriate and that the store method securely handles the signed storage URL creation.

  • 196-198: A new route for uploading files has been added. Ensure that the file upload process is secure, that proper validation is in place, and that the upload method handles the file data correctly.

  • 200-207: A new route for serving temporary local files has been added. Verify that the route securely serves files, that the signature is validated, and that the correct MIME type is set in the response headers.

  • 209-210: A new route for handling Caddy certificate requests has been added. Confirm that the ask method and the CaddyRequestMiddleware middleware are correctly implemented to handle certificate requests securely.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 062e38c and eea2ac5.
Files selected for processing (2)
  • app/Providers/RouteServiceProvider.php (1 hunks)
  • routes/web.php (2 hunks)
Additional comments: 2
routes/web.php (1)
  • 1-6: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-11]

The provided snippet of routes/web.php does not show any changes, but based on the PR objectives and the AI-generated summary, it seems that route definitions and certain imports have been removed. Please ensure that all necessary route definitions have been appropriately migrated to routes/api.php and that the removal of imports does not affect any remaining routes in this file.

app/Providers/RouteServiceProvider.php (1)
  • 43-43: The changes to the boot method in RouteServiceProvider.php reflect the removal of the 'api' prefix from routes and the direct application of the 'api' middleware. This aligns with the PR objectives. However, ensure that all routes previously under the 'api' middleware are still functioning as expected and that no routes require the 'spa' middleware that has been removed.

@JhumanJ JhumanJ merged commit 57ce0e6 into migrate-to-nuxt Jan 12, 2024
0 of 2 checks passed
@JhumanJ JhumanJ deleted the migrate-to-nuxt-remove-api-prefix-from-routes branch January 12, 2024 16:35
JhumanJ added a commit that referenced this pull request Jan 15, 2024
* wip

* Managed to load a page

* Stuck at changing routes

* Fixed the router, and editable div

* WIP

* Fix app loader

* WIP

* Fix check-auth middleware

* Started to refactor input components

* WIP

* Added select input, v-click-outside for vselect

* update vselect & phone input

* Fixed the mixin

* input component updates

* Fix signature input import

* input component updates in vue3

* image input in vue3

* small fixes

* fix useFormInput watcher

* scale input in vue3

* Vue3: migrating from vuex to Pinia (#249)

* Vue3: migrating from vuex to Pinia

* toggle input fixes

* update configureCompat

---------

Co-authored-by: Forms Dev <[email protected]>

* support vue3 query builder

* Refactor inpus

* fix: Vue3 Query Builder - Logic Editor (#251)

* support vue3 query builder

* upgrade

* remove local from middleware

* Submission table pagination & migrate chart to vue3 (#254)

* Submission table Pagination in background

* migrate chart to vue3

* Form submissions pagination

* Form submissions

* Fix form starts

* Fix openSelect key issue

---------

Co-authored-by: Forms Dev <[email protected]>
Co-authored-by: Julien Nahum <[email protected]>

* Vue 3 better animation (#257)

* vue-3-better-animation

* Working on migration to vueuse/motion

* Form sidebar animations

* Clean code

* Added animations for modal

* Finished implementing better animations

---------

Co-authored-by: Forms Dev <[email protected]>

* Work in progress

* Migrating amplitude and crisp plugin/composable

* Started to refactor pages

* WIP

* vue3-scroll-shadow-fixes (#260)

* WIP

* WIP

* WIP

* Figured out auth & middlewares

* WI

* Refactoring stores and templates pages to comp. api

* Finishing the templates pages

* fix collapsible

* Finish reworking most templates pages

* Reworked workspaces store

* Working on home page and modal

* Fix dropdown

* Fix modal

* Fixed form creation

* Fixed most of the form/show pages

* Updated cors dependency

* fix custom domain warning

* NuxtLink migration (#262)

Co-authored-by: Forms Dev <[email protected]>

* Tiny fixes + start pre-rendering

* migrate-to-nuxt-useappconfig (#263)

* migrate-to-nuxt-useappconfig

* defineAppConfig

---------

Co-authored-by: Forms Dev <[email protected]>

* Working on form/show and editor

* Globally import form inputs to fix resolve

* Remove vform - working on form public page

* Remove initform mixin

* Work in progress for form create guess user

* Nuxt Migration notifications (#265)

* Nuxt Migration notifications

* @input to @update:model-value

* change field type fixes

* @update:model-value

* Enable form-block-logic-editor

* vue-confetti migration

* PR request changes

* useAlert in setup

* Migrate to nuxt settings page AND remove axios (#266)

* Settings pages migration

* remove axios and use opnFetch

* Make created form reactive (#267)

* Remove verify pages and axios lib

---------

Co-authored-by: Julien Nahum <[email protected]>

* Fix alert styling + bug fixes and cleaning

* Refactor notifications + add shadow

* Fix vselect issue

* Working on page pre-rendering

* Created NotionPages store

* Added sitemap on nuxt side

* Sitemap done, working on aws amplify

* Adding missing module

* Remove axios and commit backend changes to sitemap

* Fix notifications

* fix guestpage editor (#269)

Co-authored-by: Julien Nahum <[email protected]>

* Remove appconfig in favor of runtimeconfig

* Fixed amplitude bugs, and added staging environment

* Added amplify file

* Change basdirectory amplify

* Fix loading bar position

* Fix custom redirect (#273)

* Dirty form handling - nuxt migration (#272)

* SEO meta nuxt migration (#274)

* SEO meta nuxt migration

* Polish seo metas, add defaults for OG and twitter

---------

Co-authored-by: Julien Nahum <[email protected]>

* migrate to nuxt useClipboard (#268)

* Set middleware on pages (#278)

* Se middleware on pages

* Se middleware on account page

* add robots.txt (#276)

* 404 page migration (#277)

* Templates pages migration (#275)

* NuxtImg Migration (#279)

Co-authored-by: Julien Nahum <[email protected]>

* Update package json

* Fix build script

* Add loglevel param

* Disable page pre-rendering

* Attempt to allow svgs

* Fix SVGs with NuxtImage

* Add .env file at AWS build time

* tRGIGGER deploy

* Fix issue

* ANother attrempt

* Fix typo

* Fix env?

* Attempt to simplify build

* Enable swr caching instead of prerenderign

* Better image compression

* Last attempt at nuxt images efficiency

* Improve image optimization again

* Remove NuxtImg for non asset files

* Restore templates pages cache

* Remove useless images + fix templates show page

* image optimization caching + fix hydratation issue form template page

* URL generation (front&back) + fixed authJWT for SSR

* Fix composable issue

* Fix form share page

* Embeddable form as a nuxt middleware

* Fix URL for embeddable middleware

* Debugging embeddable on amplify

* Add custom domain support

* No follow for non-production env

* Fix sentry nuxt and custom domain redirect

* remove api prefix from routes (#280)

* remove api prefix from routes

* PR changes

---------

Co-authored-by: Julien Nahum <[email protected]>

* nuxt migration -file upload - WIP (#271)

Co-authored-by: Julien Nahum <[email protected]>

* Fix local file upload

* Fix file submissions preview

* API redirect to back-end from nuxt

* API redirect to back-end from nuxt

* Remove old JS app, update deploy script

* Fix tests, added gh action nuxt step

* Updated package-lock.json

* Setup node in GH Nuxt action

* Setup client directory for GH workflow

---------

Co-authored-by: Forms Dev <[email protected]>
Co-authored-by: Chirag Chhatrala <[email protected]>
Co-authored-by: Rishi Raj Jain <[email protected]>
Co-authored-by: formsdev <[email protected]>
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