3.12.0 • Published 12 months ago

@alterior/fastify v3.12.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@/express

Access Express state within an Alterior app.

Why?

@alterior/web-server provides WebEvent.request which exposes the HTTP request object of the underlying web server framework being used. Alterior supports more than one framework, including express and fastify. Technically the minimum shape of WebEvent.request is that of the request object defined by the Node.js http module. As an app developer which uses Express as the server framework in my Alterior app, I want to access WebEvent.request with a Typescript type that exposes all that Express provides, not just as a generic Node.js http request object. I don't want to manually cast this object whenever I use it.

Since WebEvent.request is static (using the HTTP request's Zone to determine the appropriate value), we can create new ways to access this value which are appropriately typed.

Splitting this functionality into a specific package lets us remove unused code when not using Express.

How

import { ExpressContext } from '@alterior/express';
// ...

@WebService() 
export class MyService {
    @Get()
    info() {
        console.log(`user agent is: ${ExpressContext.request.header('User-Agent')}`);
    }
}
3.9.2

1 year ago

3.9.1

1 year ago

3.9.5

12 months ago

3.9.4

12 months ago

3.10.1

12 months ago

3.10.0

12 months ago

3.10.3

12 months ago

3.12.0

12 months ago

3.10.2

12 months ago

3.8.1

12 months ago

3.11.0

12 months ago

3.11.2

12 months ago

3.11.1

12 months ago

3.9.0

1 year ago

3.8.0

1 year ago

3.7.6

1 year ago

3.7.5

1 year ago

3.7.4

1 year ago

3.7.2

1 year ago

3.7.1

1 year ago

3.7.0

1 year ago

3.6.7

1 year ago

3.6.5

1 year ago

3.6.4

1 year ago

3.6.2

1 year ago

3.6.1

1 year ago

3.6.0

1 year ago

3.5.7

1 year ago

3.5.6

1 year ago

3.5.5

1 year ago

3.5.8

1 year ago

3.5.3

1 year ago

3.5.2

1 year ago

3.5.1

1 year ago

3.5.0

2 years ago

3.4.0

2 years ago

3.4.1

2 years ago

3.3.1

2 years ago

3.2.0

2 years ago

3.3.2

2 years ago

3.1.15

2 years ago

3.1.14

2 years ago

3.1.12

2 years ago

3.1.13

2 years ago

3.0.4

3 years ago

3.1.0

2 years ago

3.1.6

2 years ago

3.0.6

2 years ago

3.1.4

2 years ago

3.0.5

3 years ago

3.0.0-rc.9

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

3.0.0-rc.8

3 years ago

3.0.0-rc.7

3 years ago

3.0.0-rc.6

3 years ago

3.0.0-rc.5

4 years ago