alado 2.2.8 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +22 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -823,6 +823,28 @@ setAvatar(req) {
823
823
  }
824
824
  ```
825
825
 
826
+ 3. Respond with Stream:
827
+
828
+ ```ts
829
+ @get('/user/:id/avatar', { tags: ['User'] })
830
+ @withAuth(bearerAuth)
831
+ @defineResponse({
832
+ statusCode: 200,
833
+ title: 'OK',
834
+ headers: { 'Content-Type': 'image/png' },
835
+ body: {},
836
+ })
837
+ @defineRequest({ path: Id })
838
+ public getAvatar(req: Request) {
839
+ const readStream = createReadStream(`./uploads/user-${req.path.id}.png`);
840
+ return {
841
+ statusCode: 200,
842
+ headers: { 'Content-Type': 'image/png' },
843
+ body: readStream,
844
+ };
845
+ }
846
+ ```
847
+
826
848
  ---
827
849
 
828
850
  ## OpenAPI / Swagger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alado",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "description": "Extremely fast, lightweight, robust framework for HTTP applications written in Node.js",
5
5
  "keywords": [
6
6
  "HTTP",