
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.
@aws-smithy/server-node
Advanced tools
Base components for Smithy services running on NodeJS
This package provides glue code to enable using a server sdk with NodeJS.
import { createServer, IncomingMessage, ServerResponse } from "http";
import { HttpRequest } from "@aws-sdk/protocol-http";
import {
GreetingService as __GreetingService,
SayHelloInput,
SayHelloOutput,
getGreetingServiceHandler,
} from "@greeting-service/service-greeting";
import { convertEvent, convertResponse } from "@aws-smithy/server-node";
class GreetingService implements __GreetingService {
SayHello(input: SayHelloInput, request: HttpRequest): SayHelloOutput {
return {
greeting: `Hello ${input.name}! How is ${input.city}?`,
};
}
}
const serviceHandler = getGreetingServiceHandler(new GreetingService());
const server = createServer(async function (
req: IncomingMessage,
res: ServerResponse<IncomingMessage> & { req: IncomingMessage }
) {
// Convert NodeJS's http request to an HttpRequest.
const httpRequest = convertRequest(req);
// Call the service handler, which will route the request to the GreetingService
// implementation and then serialize the response to an HttpResponse.
const httpResponse = await serviceHandler.handle(httpRequest);
// Write the HttpResponse to NodeJS http's response expected format.
return writeResponse(httpResponse, res);
});
server.listen(3000);
console.error("Listening on port 3000");
FAQs
Base components for Smithy services running on NodeJS
The npm package @aws-smithy/server-node receives a total of 402 weekly downloads. As such, @aws-smithy/server-node popularity was classified as not popular.
We found that @aws-smithy/server-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 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.