POST для создания новых ресурсов
POST для остальных кастомных глаголов
PATCH для обновления ресурсов. В 99,99% на обновление уходят не все поля ('created_at' и 'updated_at' так точно)
На PUT можно забить =)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HTTP_STATUS_CODES = { | |
'CODE_200' : 'OK', | |
'CODE_201' : 'Created', | |
'CODE_202' : 'Accepted', | |
'CODE_203' : 'Non-Authoritative Information', | |
'CODE_204' : 'No Content', | |
'CODE_205' : 'Reset Content', | |
'CODE_206' : 'Partial Content', | |
'CODE_300' : 'Multiple Choices', | |
'CODE_301' : 'Moved Permanently', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for run localtunnel | |
# https://github.com/localtunnel/localtunnel | |
##### Constants | |
SUBDOMAIN='name' | |
PORT=8080 |
В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)
Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им пароля с паролем, сохранённым в базе данных пользователей;
Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.
- При регистрации юзер вводит некий пароль
- Генерим случайную соль индивилуально для каждого юзера
- Создаем хеш на основе введенного юзером пароля и соли
- Записываем хеш(не пароль) в БД + соль в отдельном филде
- Юзер вводит в поле авторизации некий пароль
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// Файл "tsconfig.json": | |
// - устанавливает корневой каталог проекта TypeScript; | |
// - выполняет настройку параметров компиляции; | |
// - устанавливает файлы проекта. | |
// Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта. | |
// Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта. | |
// Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга. | |
// Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути. | |
// Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию. | |
// Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((nm, tm) => { | |
const lStorage = localStorage; | |
const sStorage = sessionStorage; | |
const tabId = sStorage.getItem(tm) | |
|| ((newId) => { | |
sStorage.setItem(tm, newId); | |
return newId; | |
})((Math.random() * 1e8).toFixed()); | |
const update = (setTabValue) => { | |
let currentValue = JSON.parse(lStorage.getItem(nm) || '{}'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ================================= | |
# List all node_modules | |
# Linux. | |
$ cd documents | |
$ find . -name "node_modules" -type d -prune -print | xargs du -chs | |
# Windows | |
$ cd documents | |
$ FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prune images | |
$ docker image prune | |
or | |
$ docker image prune -a | |
# Prune containers | |
$ docker container prune | |
# Prune volumes | |
$ docker volume prune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, remove the old version: | |
# If installed via apt-get | |
sudo apt-get remove docker-compose | |
# If installed via curl | |
sudo rm /usr/local/bin/docker-compose | |
# If installed via pip | |
pip uninstall docker-compose |
OlderNewer