Skip to content

Instantly share code, notes, and snippets.

View austinhallett's full-sized avatar

Austin Hallett austinhallett

View GitHub Profile
@austinhallett
austinhallett / app.js
Created March 27, 2024 13:27
Idea for a wrapper around Express.js to automatically document API endpoints using Zod. Similar to FastAPI's auto documentation functionality
const express = require('express');
const { z } = require('zod');
const { generateOpenAPISpec } = require('./openapi-generator');
const app = express();
// Wrapper middleware function
function validateSchema(schema) {
return function (req, res, next) {
try {
@austinhallett
austinhallett / main.go
Created January 9, 2024 00:13
Builder pattern in Go
package main
import "fmt"
// Example object which may require optional arguments
type Server struct {
port int
host string
debug bool
}