All quizzesHard
Versioning & Streaming — Series 3
Preview — 3 of 10 questions
What distinguishes this from header versioning?
javascript
app.enableVersioning({ type: VersioningType.MEDIA_TYPE, key: 'v=' });
// client: Accept: application/json;v=2AIt versions the transport rather than the resource
BThe version travels inside the standard Accept header as a media-type parameter, so it participates in content negotiation and in Vary-based caching without introducing a custom header that proxies may strip or ignore
CIt allows only integer versions, unlike the other strategies
DIt applies to responses only; requests are matched by URI
What sequence retires v1 safely?
javascript
app.enableVersioning({ type: VersioningType.URI, defaultVersion: '1' });
// goal: make v2 the default, then remove v1AChange defaultVersion to '2' and delete the v1 controllers in the same deploy
BRemove the v1 routes first; clients still calling them will retry against v2
CKeep both versions forever, since a removed version breaks unknown clients
DShip v2 alongside v1; announce the retirement with Deprecation/Sunset on v1 responses; watch traffic per version until v1 calls approach zero; switch defaultVersion to '2'; then remove v1 in a later deploy
Why does this struggle with large files, and what changes?
javascript
@Post('avatar')
@UseInterceptors(FileInterceptor('file'))
upload(@UploadedFile() file: Express.Multer.File) {
return this.s3.putObject({ Body: file.buffer, /* ... */ });
}AThe interceptor buffers the whole file — in memory with the default storage, or to a temporary file on disk — before the handler runs, so peak usage scales with file size times concurrency; streaming the request body straight to storage keeps memory flat, at the cost of giving up the convenience of a fully-received file object
BMulter rejects files above 1 MB unless limits is raised
CThe AWS SDK cannot accept a buffer, only a stream
DThe interceptor runs after the handler, so file is undefined for large uploads
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.