-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Spike: Create Route in JSLB4 #2474
Comments
(1)
This part does not make sense to me. Routes are implemented as functions, see e.g. here: this.route('get', '/hi', {responses: {}}, () => 'Hi!'); (2) (3) (4) // a mock-up I am typing from my head, may be wrong in spec details
this.route('post', '/products', {
requestBody: {
content: {
'application/json': {
schema: buildOpenApiSchemaForModel(Product)
},
},
},
responses: {
'200': {
description: 'Product created',
content:
'application/json': {
schema: buildOpenApiSchemaForModel(Product)
},
},
},
}, (data) => productRepository.create(data)); I think we will need to address this part for controllers too (#2478) depending on which approach we choose. (5) // a mock-up I am typing from my head, may be wrong in spec details
this.route('post', '/products', {
requestBody: buildRequestBodySpecForModel(Product),
responses: {
'200': buildResponseSpecForModel(Product, 'ProductyCreated')
},
}, (data) => productRepository.create(data)); |
See also #1978 (comment) for few ideas on how to make routes easy to implement in JavaScript. |
@hacksparrow , we would like you to update the |
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
Follow up task of #1978.
Acceptance criteria
Should be created as a class
Should be useable with JSLB4 Application class
Should have access to:
@loopback/authentication
.ModelRepositoryUPDATE 2019-03-12 @raymondfeng @hacksparrow and @bajtos discussed this requirement and agreed it's good enough to pass
requestContext
as the first argument to the handler function. We need to preserve backwards compatibility for handlers that are not expecting the context in their parameters.The text was updated successfully, but these errors were encountered: