Skip to content

Instantly share code, notes, and snippets.

View trpapp's full-sized avatar
🏹
Lord, save us from the arrows of the Hungarians.

Thomas R. Papp trpapp

🏹
Lord, save us from the arrows of the Hungarians.
View GitHub Profile
@stif
stif / http-server.js
Last active April 1, 2024 04:10
node.js HTTP Server
import * as http from 'http'
import { URL } from 'url'
import { stat, readFile } from 'fs/promises';
import { join, extname } from 'path';
// you can pass the parameter in the command line. e.g. node http_server.js 3000
const port = process.argv[2] || 9000;
// maps file extention to MIME types