@@ -10,6 +10,7 @@ import struct Logging.Logger
1010import enum MacroCore. process
1111import enum MacroCore. EventListenerSet
1212import protocol MacroCore. EnvironmentKey
13+ import struct MacroCore. EnvironmentValues
1314import class http. IncomingMessage
1415import class http. ServerResponse
1516
@@ -357,6 +358,39 @@ enum ExpressExtKey {
357358 }
358359}
359360
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+
360394// MARK: - App access helper
361395
362396public extension Dictionary where Key : ExpressibleByStringLiteral {
0 commit comments