
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
artprompt-trpc-server
Advanced tools
End-to-end typesafe APIs made easy
@trpc/server
Create tRPC routers and connect them to a server.
Full documentation for @trpc/server
can be found here
# npm
npm install @trpc/server@next
# Yarn
yarn add @trpc/server@next
# pnpm
pnpm add @trpc/server@next
We also recommend installing zod
to validate procedure inputs.
import { inferAsyncReturnType, initTRPC } from '@trpc/server';
import {
CreateHTTPContextOptions,
createHTTPServer,
} from '@trpc/server/adapters/standalone';
import { z } from 'zod';
// Initialize a context for the server
function createContext(opts: CreateHTTPContextOptions) {
return {};
}
// Get the context type
type Context = inferAsyncReturnType<typeof createContext>;
// Initialize tRPC
const t = initTRPC.context<Context>.create();
// Create main router
const appRouter = t.router({
// Greeting procedure
greeting: t.procedure
.input(
z.object({
name: z.string(),
}),
)
.query(({ input }) => `Hello, ${input.name}!`),
});
// Export the app router type to be imported on the client side
export type AppRouter = typeof appRouter;
// Create HTTP server
const { listen } = createHTTPServer({
router: appRouter,
createContext,
});
// Listen on port 2022
listen(2022);
FAQs
tRPC Server
We found that artprompt-trpc-server demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.