flamerest
v1.0.126
Published
Promise based, easy and fast methods for MySQL requests.
Downloads
58
Readme
REST JS
Promise based, easy and fast methods for MySQL requests.
npm install flamerest --saveUsage
import FLAMEREST from "flamerest";
Vue.use(new FLAMEREST([custom_endpoint]));or
import FLAMEREST from "flamerest";
window.REST = new FLAMEREST('localhost');Callbacks
Unauthorized Callback
Обработка 401 ошибок (неавторизован):
const rest = new FLAMEREST('https://api.example.com', undefined, () => {
// Пользователь не авторизован - перенаправляем на страницу входа
window.location.href = '/login';
});Maintenance Callback
Обработка 503 ошибок (сервер на обслуживании):
const rest = new FLAMEREST('https://api.example.com', undefined, undefined, 'v1', (errorMessage) => {
// Сервер на обслуживании
if (errorMessage) {
alert(`Сервер временно недоступен: ${errorMessage}`);
} else {
alert('Сервер временно недоступен. Попробуйте позже.');
}
// Можно показать модальное окно с сообщением об обслуживании
});Create and Update
Just field list, but any field can be HTML Input [type=file], Clipboard object, DataTransfer [Drag&Drop/Clipboard] or FileList (automatically upload any of that)
Delete
Function Remove. Can delete row by primaryKey - second parameter, or mass delete by fields condition - third parameter with fields
