Sponsor Adventures in Nodeland
Last updated: May 2022
- 1700+ subscribers
- Qualified and engaged audience that like receiving my emails
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Page Title</title> | |
<base href="https://example.com/page.html"> | |
<link rel="stylesheet" href="styles.css" type="text/css"> | |
<style type="text/css"> | |
</style> |
'use strict'; | |
const assert = require('node:assert'); | |
const fs = require('node:fs/promises'); | |
const DATA_HOME_URL = 'https://storage.googleapis.com/access-logs-summaries-nodejs/index.html'; | |
const DATA_FILE_PATH = 'data.json'; | |
const DATA_CSV_PATH = 'data.csv'; | |
const DATA_CSV_SEVEN_DAY_PATH = 'data-seven-day-avg.csv'; | |
const LINES = ['14', '16', '18', '19', '20']; | |
async function main() { |
# set-option -g default-command "reattach-to-user-namespace -l /bin/bash" | |
set -g default-terminal "screen-256color" | |
# Pane resizing | |
bind -r H resize-pane -L 5 | |
bind -r J resize-pane -D 5 | |
bind -r K resize-pane -U 5 | |
bind -r L resize-pane -R 5 | |
# splitting panes |
const pinoStdSerializers = require('pino-std-serializers') | |
const logger = require('pino')({ | |
serializers: { | |
error: pinoStdSerializers.err | |
} | |
}) | |
try { | |
throw new Error('kaboom') | |
} catch (error) { |
import { createServer } from 'http' | |
import { connect } from 'net' | |
const server = createServer(function (req, res) { | |
console.log('request!') | |
server.close() | |
res.setHeader('Connection', 'close') | |
res.end('hello world') | |
}) |
#!/bin/sh | |
VERSION=$1 | |
MODULES=`node -e "console.log(require('./package.json').workspaces.join(' '))"` | |
for MODULE in $MODULES; do | |
echo "Building $MODULE" | |
pushd $MODULE | |
npm version $VERSION --save | |
NAME=`node -e "console.log(require('./package.json').name)"` |
// Run this with npx jest globals-jest-problem.test.js | |
// This is because of https://github.com/facebook/jest/issues/2549 | |
const assert = require('assert') | |
test('assert', () => { | |
try { | |
assert.strictEqual(2, 3) | |
} catch (err) { | |
// This will fail |
Last updated: May 2022
npm i fastify@next |
import Fastify from 'fastify' | |
const app = Fastify({ logger: true }) | |
app.get('/', async (request, reply) => { | |
setImmediate(() => { | |
reply.send({ hello: 'world' }) | |
}) | |
// return reply is needed to tell Fastify we will call | |
// reply.send() in the future. |