
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@rshb/http
Advanced tools
Библиотека для взаимодействия с API проекта Свой Бизнес.
import { api } from "@rshb/http/api/monolith";
const fetchClients = async () => {
try {
const clientsResponse = await api.clients.clientsList();
} catch (error) {
console.log(error));
}
}
Библиотека требует наличия переменной окружения указанной в process.env.API_URL
, значение которой используется в качестве параметра baseUrl
в HttpClient'е.
Если вам понадобилось использовать несколько версий http-клиента, вы можете импортировать базовый класс Api
для создания собственного экземпляра клиента:
import { Api } from "@rshb/http/api/monolith";
const api = new Api({
baseUrl: "https://base.url.ru"
});
const fetchClients = async () => {
try {
const clientsResponse = await api.clients.clientsList({
baseUrl: "https://custom.base.url.ru"
});
} catch (error) {
console.log(error));
}
}
Для обеспечения типобезопасного взаимодействия с API, мы используем swagger-спецификацию версии 2.0. Для автоматической генерации новой версии API необходимо добавить обновленную версию файла src/api/monolith/swagger/rest-front-api-v1.yml
и выполнить команду yarn generate-monolith-api
. Актуальную версию спецификации rest-front-api-v1
можно получить по запросу у backend-разработчиков.
Для обеспечения обратной совместимости предоставляется возможность использования старой версии http-клиента:
import { GET } from "@rshb/http/client/deprecated";
const fetchClients = async () => {
try {
const clientsResponse = await GET("/clients");
} catch (error) {
console.log(error));
}
}
Данный http-клиент является устаревшим и будет удален после миграции проектов на новую версию.
FAQs
Библиотека для взаимодействия с API проекта Свой Бизнес.
The npm package @rshb/http receives a total of 0 weekly downloads. As such, @rshb/http popularity was classified as not popular.
We found that @rshb/http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.