A functional REST API server start with restify and typeorm
- typescript
- restify (server)
- typeorm (database manager)
- inversify (DI)
- inversify-restify-utils
- docker
- bcryptjs: A library to help you hash passwords.
- url: https://hub.docker.com/_/mysql
- version: 8.0
Known issue
MySQL 8 has supports pluggable authentication methods. By default, one of them named caching_sha2_password is used rather than our good old mysql_native_password (source).
- How to fix?
- After bring up the server in docker, connect to
db-mysql
container:
$ docker exec -it <container_id> sh
- Login mysql as
root
user in the docker container
$ mysql -uroot -p
enter root password.
- Update the authentication method in mysql for the db user.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
change root
, localhost
and password
as needed. Then refresh the privileges:
flush privileges;
- Restart the docker-compose