1.1.0 • Published 8 years ago
@lisbakke/expresserator v1.1.0
Decorators for Express
Decorators for http path (e.g. /api/foo/bar
), http verb (e.g. GET
) and defining input parameters.
Example
@Root('/foo')
class Greeter {
@Path('/hello', 'get')
@GetParam('fooNumber', {type: TYPE_NUMBER, required: true})
@GetParam('fooString', {type: TYPE_STRING, required: true})
@GetParam('fooBoolean', {type: TYPE_BOOLEAN, required: true})
async helloGet(req, res, next, fooNumber, fooString, fooBoolean) {
await timeout(100);
res.json({greeting: `Hello Get. fooNumber ${fooNumber} fooString ${fooString} fooBoolean ${fooBoolean}`});
}
@Path('/hello', 'post')
@PostParam('fooNumber', {type: TYPE_NUMBER, required: true})
@PostParam('fooArray', {type: TYPE_ARRAY, required: true})
@PostParam('fooString', {type: TYPE_STRING, required: true})
@PostParam('fooBoolean', {type: TYPE_BOOLEAN, required: true})
async helloPost(req, res, next, fooNumber, fooArray, fooString, fooBoolean) {
await timeout(100);
res.json({greeting: `Hello Post. fooNumber ${fooNumber} fooArray ${fooArray} fooString ${fooString} fooBoolean ${fooBoolean}`});
}
}
1.1.0
8 years ago
1.0.23
8 years ago
1.0.22
8 years ago
1.0.21
8 years ago
1.0.20
8 years ago
1.0.19
8 years ago
1.0.18
8 years ago
1.0.17
8 years ago
1.0.16
8 years ago
1.0.15
8 years ago
1.0.14
8 years ago
1.0.13
8 years ago
1.0.12
8 years ago
1.0.11
8 years ago
1.0.10
8 years ago
1.0.9
8 years ago
1.0.8
8 years ago
1.0.7
8 years ago
1.0.4
8 years ago
1.0.6
8 years ago
1.0.5
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago