A decorator to tell the Server that a class or a method should only accept requests from clients that accepts one of the supported languages.
For example:
@ Path('accept')
@ AcceptLanguage('en', 'pt-BR')
class TestAcceptService {
// ...
}
Will reject requests that only accepts languages that are not English or Brazilian portuguese
If the language requested is not supported, a status code 406 returned
Decorator processor for AcceptLanguage decorator on methods
Decorator processor for AcceptLanguage decorator on classes
Decorator processor for Accept decorator on methods
Decorator processor for Accept decorator on classes
A decorator to inform options to pe passed to bodyParser. You can inform any property accepted by [bodyParser]
A decorator to be used on class properties or on service method arguments to inform that the decorated property or argument should be bound to the ServiceContext object associated to the current request.
For example:
@ Path('context')
class TestService {
@ Context
context: ServiceContext;
// ...
}
The field context on the above class will point to the current ServiceContext instance.
A decorator to be used on class properties or on service method arguments to inform that the decorated property or argument should be bound to the the preferred media type for the current request.
For example:
@ Path('context')
class TestService {
@ ContextAccept
media: string
// ...
}
A decorator to be used on class properties or on service method arguments to inform that the decorated property or argument should be bound to the the current context language.
For example:
@ Path('context')
class TestService {
@ ContextLanguage
language: string
// ...
}
A decorator to be used on class properties or on service method arguments to inform that the decorated property or argument should be bound to the the next function.
For example:
@ Path('context')
class TestService {
@ ContextNext
next: express.NextFunction
// ...
}
The next function can be used to delegate to the next registered middleware the current request processing.
A decorator to be used on class properties or on service method arguments to inform that the decorated property or argument should be bound to the the current request.
For example:
@ Path('context')
class TestService {
@ ContextRequest
request: express.Request;
// ...
}
The field request on the above class will point to the current request.
A decorator to be used on class properties or on service method arguments to inform that the decorated property or argument should be bound to the the current response object.
For example:
@ Path('context')
class TestService {
@ ContextResponse
response: express.Response;
// ...
}
The field response on the above class will point to the current response object.
Creates a mapping between a cookie on request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ GET
getPeople(@ CookieParam('cookie') cookie: string) {
// ...
}
}
Will create a service that listen for requests and bind the cookie called 'cookie' to the cookie argument on getPerson method's call.
A decorator to tell the Server that a method should be called to process HTTP DELETE requests.
For example:
@ Path('people')
class PeopleService {
@ DELETE
@ Path(':id')
removePerson(@ PathParam('id')id: string) {
// ...
}
}
Will create a service that listen for requests like:
PUT http://mydomain/people/123
Creates a mapping between a file on a multipart request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ POST
@ Path('id')
addAvatar(@ PathParam('id') id: string,
@ FileParam('avatar') file: Express.Multer.File) {
// ...
}
}
Will create a service that listen for requests and bind the file with name 'avatar' on the requested form to the file argument on addAvatar method's call.
Creates a mapping between a list of files on a multipart request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ POST
@ Path('id')
addAvatar(@ PathParam('id') id: string,
@ FilesParam('avatar') Array<file>: Express.Multer.File) {
// ...
}
}
Will create a service that listen for requests and bind the files with name 'avatar' on the request form to the file argument on addAvatar method's call.
Creates a mapping between a form parameter on request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ GET
getPeople(@ FormParam('name') name: string) {
// ...
}
}
Will create a service that listen for requests and bind the request paramenter called 'name' to the name argument on getPerson method's call.
A decorator to tell the Server that a method should be called to process HTTP GET requests.
For example:
@ Path('people')
class PeopleService {
@ GET
getPeople() {
// ...
}
}
Will create a service that listen for requests like:
GET http://mydomain/people
A decorator to tell the Server that a method should be called to process HTTP HEAD requests.
For example:
@ Path('people')
class PeopleService {
@ HEAD
headPerson() {
// ...
}
}
Will create a service that listen for requests like:
HEAD http://mydomain/people/123
Creates a mapping between a header on request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ GET
getPeople(@ HeaderParam('header') header: string) {
// ...
}
}
Will create a service that listen for requests and bind the header called 'header' to the header argument on getPerson method's call.
A decorator to tell the Server that a method should be called to process HTTP OPTIONS requests.
For example:
@ Path('people')
class PeopleService {
@ OPTIONS
optionsPerson() {
// ...
}
}
Will create a service that listen for requests like:
OPTIONS http://mydomain/people/123
A decorator to tell the Server that a method should be called to process HTTP PATCH requests.
For example:
@ Path('people')
class PeopleService {
@ PATCH
@ Path(':id')
savePerson(person: Person) {
// ...
}
}
Will create a service that listen for requests like:
PATCH http://mydomain/people/123
A decorator to tell the Server that a method should be called to process HTTP POST requests.
For example:
@ Path('people')
class PeopleService {
@ POST
addPerson() {
// ...
}
}
Will create a service that listen for requests like:
POST http://mydomain/people
A decorator to tell the Server that a method should be called to process HTTP PUT requests.
For example:
@ Path('people')
class PeopleService {
@ PUT
@ Path(':id')
savePerson(person: Person) {
// ...
}
}
Will create a service that listen for requests like:
PUT http://mydomain/people/123
Creates a mapping between a parameter on request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ GET
getPeople(@ Param('name') name: string) {
// ...
}
}
Will create a service that listen for requests and bind the request paramenter called 'name' to the name argument on getPerson method's call. It will work to query parameters or form parameters received in the current request.
A decorator to tell the Server that a class or a method should be bound to a given path.
For example:
@ Path('people')
class PeopleService {
@ PUT
@ Path(':id')
savePerson(person:Person) {
// ...
}
@ GET
@ Path(':id')
getPerson():Person {
// ...
}
}
Will create services that listen for requests like:
PUT http://mydomain/people/123 or
GET http://mydomain/people/123
Decorator processor for Path decorator on methods
Creates a mapping between a fragment of the requested path and a method argument.
For example:
@ Path('people')
class PeopleService {
@ GET
@ Path(':id')
getPerson(@ PathParam('id') id: string) {
// ...
}
}
Will create a service that listen for requests like:
GET http://mydomain/people/123
And pass 123 as the id argument on getPerson method's call.
Decorator processor for Path decorator on classes
Creates a mapping between a query parameter on request and a method argument.
For example:
@ Path('people')
class PeopleService {
@ GET
getPeople(@ QueryParam('name') name: string) {
// ...
}
}
Will create a service that listen for requests like:
GET http://mydomain/people?name=joe
And pass 'joe' as the name argument on getPerson method's call.
Decorator processor for parameter annotations on methods
Decorator processor for annotations on properties
Decorator processor for HTTP verb annotations on methods
Extract metadata for rest methods
Generated using TypeDoc
A decorator to tell the Server that a class or a method should only accept requests from clients that accepts one of the supported mime types.
For example:
@ Path('accept') @ Accept('application/json') class TestAcceptService { // ... }
Will reject requests that only accepts mime types that are not 'application/json'
If the mime type requested is not supported, a status code 406 returned