Open trasherdk opened 1 month ago
import HyperExpress from 'hyper-express' import { request } from 'node:http' const server = new HyperExpress.Server() server.any('/api/v1', (request_, response) => { request_.pipe( request( 'http://localhost:8081/api/v1', { method: request_.method, headers: request_.headers, }, (readable) => { readable.pipe(response) }, ), ) }) const PORT = process.env['PORT'] ?? '3000' await server.listen(PORT, () => { console.log(`Service endpoint = http://localhost:${PORT}`) })