Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@grpc.ts/fastify-server
Advanced tools
Fastify's Plugin for Server.
npm install --save @grpc.ts/fastify-server
# or
yarn add @grpc.ts/fastify-server
# or
pnpm add @grpc.ts/fastify-server
// example.proto
syntax = "proto3";
import "google/protobuf/timestamp.proto";
package example.v1;
message Message {
string message = 1;
google.protobuf.Timestamp created_at = 2;
}
message SendMessageRequest {
string message = 1;
google.protobuf.Timestamp created_at = 2;
}
message GetMessageResponse { Message message = 1; }
service ExampleService {
rpc SendMessage(SendMessageRequest) returns (GetMessageResponse);
}
In fastify
import Fastify from 'fastify';
import detect from 'detect-port';
import FastifyGrpcServer, {
dateToGrpcTimestamp,
} from '@grpc.ts/fastify-server';
const fastify = Fastify({
logger: process.env.NODE_ENV === 'production' ? false : true,
});
async function bootstrap(): Promise<typeof fastify> {
fastify.register(FastifyGrpcServer, {
url: 'localhost:3010',
package: [
{
packageName: 'example.v1',
protoPath: '../proto/example.proto',
},
{
packageName: 'example2.v1',
protoPath: '../proto/example2.proto',
},
{
protoPath: '../proto/example3.proto',
},
],
packageDefinitionOptions: {
oneofs: true,
longs: String,
enums: String,
defaults: true,
},
options: {
keepaliveTimeMs: 5_000,
},
});
const port = await detect(3_000);
await fastify.listen({
port,
});
fastify.grpcServer
.getServer()
.addUnaryHandler('ExampleService', 'sendMessage', (request, metadata) => {
console.log(request);
console.log(metadata);
return {
message: {
message: 'hola',
createdAt: dateToGrpcTimestamp(new Date()),
},
};
});
return fastify;
}
bootstrap();
FAQs
Fastify package for server
The npm package @grpc.ts/fastify-server receives a total of 69 weekly downloads. As such, @grpc.ts/fastify-server popularity was classified as not popular.
We found that @grpc.ts/fastify-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.