1.0.52 • Published 3 years ago
@anzerr/http.ts v1.0.52
Intro
Decorator for a simple http server
Install
npm install --save git+https://github.com/anzerr/http.ts.git
npm install --save @anzerr/http.ts
Example
import 'reflect-metadata';
import {Server, Controller, Get} from 'http.ts';
import {Injectable, Inject, Module} from 'inject.ts';
@Injectable()
class Log {
count: number;
constructor() {
this.count = 0;
}
info(...arg) {
this.count += 1;
return console.log(this.count, ...arg);
}
}
@Controller('user')
class Test extends Server.Controller {
@Inject(Log)
logger: Log;
@Get()
list() {
this.logger.info('list');
this.res.status(200).send('1');
}
@Get(':id')
getUser() {
this.logger.info('getUser');
this.res.status(200).send('2');
}
@Get(':id/friends')
getFriends() {
this.logger.info('getFriends');
this.res.status(200).send('3');
}
}
new Server(3000)
.withController([Test])
.start();
1.0.48
3 years ago
1.0.47
3 years ago
1.0.46
3 years ago
1.0.49
3 years ago
1.0.51
3 years ago
1.0.50
3 years ago
1.0.52
3 years ago
1.0.45
3 years ago
1.0.44
3 years ago
1.0.43
4 years ago
1.0.42
4 years ago
1.0.41
4 years ago
1.0.40
4 years ago
1.0.39
5 years ago
1.0.38
5 years ago
1.0.37
5 years ago
1.0.36
5 years ago
1.0.35
5 years ago
1.0.34
5 years ago
1.0.33
5 years ago
1.0.32
5 years ago
1.0.31
5 years ago
1.0.30
5 years ago
1.0.29
6 years ago
1.0.28
6 years ago
1.0.27
6 years ago
1.0.25
6 years ago
1.0.24
6 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.21
6 years ago
1.0.7
6 years ago
1.0.4
6 years ago
1.0.5
6 years ago
1.0.6
6 years ago