From 6da29ed54f4dd073a649378206b0d74c247dc142 Mon Sep 17 00:00:00 2001 From: Amir Hossein Zakizadeh Date: Sat, 23 Oct 2021 18:39:54 +0330 Subject: [PATCH] Upgrading to v4: Image upload API: max body size, references: https://docs.vapor.codes/4.0/routing/#body-streaming, https://github.com/vapor/vapor/pull/2312 --- Sources/App/routes.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/App/routes.swift b/Sources/App/routes.swift index 372dc54..c732a6f 100644 --- a/Sources/App/routes.swift +++ b/Sources/App/routes.swift @@ -108,7 +108,7 @@ public func routes(_ app: Application) throws { tokenProtected.put(uris.gifts_id, use: giftController.update) tokenProtected.delete(uris.gifts_id, use: giftController.delete) - tokenProtected.post(uris.image_upload, use: imageController.uploadImage) + tokenProtected.on(.POST, uris.image_upload, body: .collect(maxSize: "20mb"), use: imageController.uploadImage) tokenProtected.post(uris.gifts_userRegistered_id, use: userGifts.registeredGifts) tokenProtected.post(uris.gifts_userDonated_id, use: userGifts.donatedGifts)