-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(rest): create providers for send and parse-params
- Loading branch information
Kevin Delisle
committed
Sep 26, 2017
1 parent
636fd0b
commit 11d6dc8
Showing
5 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright IBM Corp. 2017. All Rights Reserved. | ||
// Node module: @loopback/rest | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
import {Provider, BoundValue} from '@loopback/context'; | ||
import {parseOperationArgs} from '../parser'; | ||
/** | ||
* Provides the function for parsing args in requests at runtime. | ||
* | ||
* @export | ||
* @class ParseParamsProvider | ||
* @implements {Provider<BoundValue>} | ||
* @returns {BoundValue} The handler function that will parse request args. | ||
*/ | ||
export class ParseParamsProvider implements Provider<BoundValue> { | ||
value() { | ||
return parseOperationArgs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright IBM Corp. 2017. All Rights Reserved. | ||
// Node module: @loopback/rest | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
import {Provider, BoundValue} from '@loopback/context'; | ||
import {writeResultToResponse} from '../writer'; | ||
/** | ||
* Provides the function that populates the response object with | ||
* the results of the operation. | ||
* | ||
* @export | ||
* @class SendProvider | ||
* @implements {Provider<BoundValue>} | ||
* @returns {BoundValue} The handler function that will populate the | ||
* response with operation results. | ||
*/ | ||
export class SendProvider implements Provider<BoundValue> { | ||
value() { | ||
return writeResultToResponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters