
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@yuankui/rpc-express
Advanced tools
Express integration for @yuankui/rpc - A type-safe RPC framework.
npm install @yuankui/rpc-express
# or
yarn add @yuankui/rpc-express
# or
bun add @yuankui/rpc-express
import express from 'express';
import { createRPCRouter } from '@yuankui/rpc-express';
const app = express();
app.use(express.json());
// Define your RPC endpoints
const endpoints = {
async getUser(id: number) {
// Your logic here
return { id, name: 'John Doe' };
},
async createUser(name: string, email: string) {
// Your logic here
return { id: 1, name, email };
},
};
// Create RPC router
const rpcRouter = createRPCRouter({
endpoints,
path: '/api/rpc', // Optional, defaults to '/rpc'
});
app.use(rpcRouter);
app.listen(3000, () => {
console.log('Server running on port 3000');
});
import { Router } from 'express';
import { createRPCMiddleware } from '@yuankui/rpc-express';
const apiRouter = Router();
const rpcMiddleware = createRPCMiddleware({
endpoints: {
async ping() {
return 'pong';
},
},
});
apiRouter.use('/rpc', rpcMiddleware);
import { createRPCRouter } from '@yuankui/rpc-express';
const rpcRouter = createRPCRouter({
endpoints: {
async getData() {
return new Date(); // Will be properly serialized
},
},
serializer: {
serialize: (data) => JSON.stringify(data),
deserialize: (data) => JSON.parse(data),
},
});
createRPCRouter(config)Creates an Express router with RPC endpoint handling.
config.endpoints - Object containing your RPC endpoint functionsconfig.path - (Optional) RPC endpoint path, defaults to /rpcconfig.serializer - (Optional) Custom serializer, defaults to superjsonExpress Router instance
createRPCMiddleware(config)Alias for createRPCRouter for better semantic clarity when using as middleware.
ExpressRPCHandlerClass for more advanced usage scenarios where you need direct control over the handler.
Use with the standard RPC client:
import { RPCClient } from '@yuankui/rpc-express';
type ServerEndpoints = {
getUser: (id: number) => Promise<{ id: number; name: string }>;
createUser: (name: string, email: string) => Promise<{ id: number; name: string; email: string }>;
};
const client = new RPCClient<ServerEndpoints>({
url: 'http://localhost:3000/api/rpc',
});
// Type-safe calls
const user = await client.call('getUser', 123);
const newUser = await client.call('createUser', 'Jane', 'jane@example.com');
MIT
FAQs
Express integration for @yuankui/rpc
We found that @yuankui/rpc-express 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.