Convert input param into domain entity.
@Controller('books')
export class BooksController {
@Get('/:id')
async getBook(@Param('id', IdToEntityPipe()) book: BookEntity): Promise<BookEntity> {
return book;
#!/bin/bash | |
# Install Docker, you can ignore the warning from Docker about using WSL | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
# Add your user to the Docker group | |
sudo usermod -aG docker $USER | |
# Sanity check that both tools were installed successfully |
bump-versions: | |
git submodule foreach 'git fetch origin; git checkout origin/develop' | |
git submodule foreach 'cd .. && git add $$name' | |
git commit -m 'Bump versions' | |
git show |
@Module({ | |
providers: [ | |
{ | |
provide: MyApiService, | |
useFactory: (configService: ConfigService) => { | |
return new MyApiService( | |
configService.getOrThrow('MY_BASE_URL'), | |
configService.getOrThrow('MY_USER'), | |
configService.getOrThrow('MY_PASSWORD') | |
); |
class Middleware { | |
use(fn) { | |
this.go = (prev => item => { | |
return prev(fn(item)); | |
} | |
)(this.go) | |
} | |
go(item) { | |
console.count('GO'); | |
return item; |
Find out percentage of tables created on disk
mysql> show global status like 'created_tmp_disk_tables';
+-------------------------+--------+
| Variable_name | Value |
+-------------------------+--------+
| Created_tmp_disk_tables | 278571 |
+-------------------------+--------+
1 row in set (0.00 sec)