File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed
Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -5,35 +5,41 @@ using with AWS S3 sign urls for private objects.
55
66## Basic Usage
77
8- - Register the plugin
8+ - Import the plugin
9+
10+ ``` js
11+ import { signedUrl } from ' hapi-signed-url' ;
12+ ```
13+
14+ - Register the plugin
915
1016``` js
1117await server .register ([
12- {
13- plugin: signedUrl,
14- options: {
15- getSignedUrl: (key: string): string => ' my_custom_sign' , // takes in function to sign the id
16- },
18+ {
19+ plugin: signedUrl,
20+ options: {
21+ getSignedUrl: (key: string): string => ' my_custom_sign' , // takes in function to sign the id
1722 },
23+ },
1824]);
1925```
2026
21- - Dummy response
27+ - Dummy response
2228
2329``` json
2430{
25- "file" : " random_id" ,
26- "name" : " this is a file"
31+ "file" : " random_id" ,
32+ "name" : " this is a file"
2733}
2834```
2935
30- - Create a lens using ramda for the above object
36+ - Create a lens using ramda for the above object
3137
3238``` js
3339const lens = R .lensProp < string, any> (' file' ) // here file is the key from object
3440```
3541
36- - Use it in the route
42+ - Use it in the route
3743
3844``` js
3945server .route ({
@@ -53,12 +59,12 @@ server.route({
5359});
5460```
5561
56- - Final response
62+ - Final response
5763
5864``` json
5965{
60- "file" : " random_id_SIGNATURE" , // this value will be updated
61- "name" : " this is a file"
66+ "file" : " random_id_SIGNATURE" , // this value will be updated
67+ "name" : " this is a file"
6268}
6369```
6470
@@ -105,5 +111,5 @@ server.route({
105111
106112### Note
107113
108- - It will work with single objects and arrays. ` pathToSource ` is optional field,
109- use when nested objects are to be updated.
114+ - It will work with single objects and arrays. ` pathToSource ` is optional field,
115+ use when nested objects are to be updated.
You can’t perform that action at this time.
0 commit comments