Add a “shared” directory to the api folder #10841
qFlensT
started this conversation in
Feature Requests
Replies: 1 comment
-
Sorry, didn't notice that middleware supports regexp in matcher |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Briefly: create a
shared
directory that will duplicate the route for the path.../admin/*
and.../store/*
.Currently, we have the following basic structure in the
api
folder:But with this approach, there is a problem that arises when we want an HTTP method to be available in both admin and store at once (let's say by calling HTTP method GET).
We can use the following approach:
But we still have
to duplicate the middleware codeand make an extra reexport. This is not serious, but it would be ideal to be able to declareroute
in theshared
directory once and apply other settings like those set inmiddleware.ts
and not use reexport. Plus, this approach will get official support, and a person who comes to a project wheremedusa.js
will understand what this directory is used for.Beta Was this translation helpful? Give feedback.
All reactions