@@ -10,6 +10,7 @@ import struct Logging.Logger
10
10
import enum MacroCore. process
11
11
import enum MacroCore. EventListenerSet
12
12
import protocol MacroCore. EnvironmentKey
13
+ import struct MacroCore. EnvironmentValues
13
14
import class http. IncomingMessage
14
15
import class http. ServerResponse
15
16
@@ -357,6 +358,39 @@ enum ExpressExtKey {
357
358
}
358
359
}
359
360
361
+ public extension EnvironmentValues {
362
+
363
+ var app : Express ? {
364
+ get { self [ ExpressExtKey . App. self] }
365
+ set { self [ ExpressExtKey . App. self] = newValue }
366
+ }
367
+ var request : IncomingMessage ? {
368
+ get { self [ ExpressExtKey . RequestKey. self] }
369
+ set { self [ ExpressExtKey . RequestKey. self] = newValue }
370
+ }
371
+ var route : Route ? {
372
+ get { self [ ExpressExtKey . RouteKey. self] }
373
+ set { self [ ExpressExtKey . RouteKey. self] = newValue }
374
+ }
375
+ var baseURL : String ? {
376
+ get { self [ ExpressExtKey . BaseURL. self] }
377
+ set { self [ ExpressExtKey . BaseURL. self] = newValue }
378
+ }
379
+ var params : IncomingMessage . Params {
380
+ get { self [ ExpressExtKey . Params. self] }
381
+ set { self [ ExpressExtKey . Params. self] = newValue }
382
+ }
383
+ var query : IncomingMessage . Query ? {
384
+ get { self [ ExpressExtKey . Query. self] }
385
+ set { self [ ExpressExtKey . Query. self] = newValue }
386
+ }
387
+ var locals : ServerResponse . Locals {
388
+ get { self [ ExpressExtKey . Locals. self] }
389
+ set { self [ ExpressExtKey . Locals. self] = newValue }
390
+ }
391
+ }
392
+
393
+
360
394
// MARK: - App access helper
361
395
362
396
public extension Dictionary where Key : ExpressibleByStringLiteral {
0 commit comments