Skip to content

Instantly share code, notes, and snippets.

View lesterfernandez's full-sized avatar
👋
Welcome to my profile!

Lester lesterfernandez

👋
Welcome to my profile!
View GitHub Profile
@outerlook
outerlook / Query.ts
Created March 24, 2020 19:12
Nexus-Prisma Relay Spec compliant server implementation (Work in progress, not tested)
export const Queries = queryType({
definition: (t) => {
t.field("node", {
type: "Node",
args: { id: idArg({ required: true }) },
resolve: (root, args, context, info) => {
const { id, __typename } = decode(args.id);
const objeto = __typename.charAt(0).toLowerCase() + __typename.slice(1); // from TitleCase to camelCase
return {
...context.prisma[objeto].findOne({ where: { id } }),
@nikmartin
nikmartin / A: Secure Sessions Howto
Last active July 2, 2024 05:59
Secure sessions with Node.js, Express.js, and NginX as an SSL Proxy
Secure sessions are easy, but not very well documented.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT]
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now.