Skip to content

Instantly share code, notes, and snippets.

View unwelt's full-sized avatar
🏠
Working from home

Sergey unwelt

🏠
Working from home
View GitHub Profile
@unwelt
unwelt / mysql-docker.sh
Created September 17, 2021 10:16 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@unwelt
unwelt / axios-catch-error.js
Created January 10, 2021 09:22 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨