Быстрый старт
Данный раздел описывает технические моменты, необходимые для начала интеграции.
Доступы к сервисам
services-stage-mx6hvkth4a-uc.a.run.app
services.stage.galactica.gamesservices.galactica.gamesУстановить зависимости
# Install via NPM
npm install --save @grpc/grpc-js
npm install --save @protobuf-ts/grpc-transportТранспорт и авторизация
import { GrpcTransport } from "@protobuf-ts/grpc-transport";
import { RpcOptions } from "@protobuf-ts/runtime-rpc";
import { ChannelCredentials } from "@grpc/grpc-js";
export const getTransport = (): GrpcTransport => {
const host = process.env.SERVICES_API_URL ?? "";
return new GrpcTransport({
host,
channelCredentials: host.includes('localhost')
? ChannelCredentials.createInsecure()
: ChannelCredentials.createSsl(),
});
};
export const getAuthorization = (accessToken: string): RpcOptions => {
return {
meta: {
authorization: `Bearer ${accessToken}`
}
};
};Первый запрос
Last updated