-
Notifications
You must be signed in to change notification settings - Fork 73
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
[idea] Support express.js path syntax #466
Comments
Hi, is this issue still open? |
const client = forge({
resources: {
User: {
all: { path: '/users' },
// {id} is a dynamic segment and will be replaced by the parameter "id"
// when called
byId: { path: '/users/{id}' },
// {group} is also a dynamic segment but it has default value "general"
byGroup: { path: '/users/groups/{group}', params: { group: 'general' } },
// {market?} is an optional dynamic segment. If called without a value
// for the "market" parameter, {market?} will be removed from the path
// including any prefixing "/".
// This example: '/{market?}/users' => '/users'
count: { path: '/{market?}/users' } }
},
Blog: {
// The HTTP method can be configured through the `method` key, and a default
// header "X-Special-Header" has been configured for this resource
create: { method: 'post', path: '/blogs', headers: { 'X-Special-Header': 'value' } },
// There are no restrictions for dynamic segments and HTTP methods
addComment: { method: 'put', path: '/blogs/{id}/comment' },
// `queryParamAlias` will map parameter names to their alias when
// constructing the query string
bySubject: { path: '/blogs', queryParamAlias: { subjectId: 'subject_id' } },
// `path` is a function to map passed params to a custom path
byDate: { path: ({date}) => `${date.getYear()}/${date.getMonth()}/${date.getDate()}` }
}
}
}) copy/paste from express routes definitions can simplify forge configuration greatly |
Hi, what is the requirement I mean is there any modification or feature addition in the above you mentioned? |
could you elaborate the requirement with proper file path. |
Please let me know the complete requirement on this, would like to contribute on that. |
Hi, could you provide requirement for this issue ? |
Hi @OleksandrKucherenko, could you explain the issue, what is required in detail. |
Its not an issue, its the enhancment. Most of the BE are done in expressjs, so when i need to create a client i should do a lot of copy/paste modifications. Support of the expressjs route pathes by default will reduce the adoptation time. |
so is there any thing on which I can contribute ? |
Hmm., this must be an AI chatbot? |
Overview:
example:
/users/:userId/books/:bookId
refs:
The text was updated successfully, but these errors were encountered: