-
Notifications
You must be signed in to change notification settings - Fork 1
TransparentServicesAndZone
William Lahti edited this page Feb 7, 2021
·
1 revision
Transparent Services must not have irrelevant implementation details exposed in the signatures of its methods. Therefore @/web-server's RouteEvent
is deprecated and will be removed. We will resolve this using Zone.js, and introduce a new way to represent Sessions at the same time.
import { WebService, Get, WebResponse } from '@alterior/web-server';
@WebService()
export class MyService {
@Get()
get() {
return {
service: '@example/my-service',
userAgent: WebRequest.current.userAgent
};
}
}
import { WebService, Get, WebResponse } from '@alterior/web-server';
@WebService()
export class MyService {
@Get()
get() {
WebResponse.current.status(418).send("I'm a teapot!") // I'm a teapot
}
}
import { WebSession, WebService, Get } from '@alterior/web-server';
export class MySession extends WebSession {
count = 0;
}
@WebService()
export class MyService {
@Get()
get() {
MySession.current.count += 1
return {
service: '@example/my-service',
count: MySession.current.count
};
}
}