Skip to content

Instantly share code, notes, and snippets.

View Shair17's full-sized avatar
🖖
Code, code and more code!

Shair Shair17

🖖
Code, code and more code!
View GitHub Profile
@Shair17
Shair17 / fastify-decorators-example.ts
Created November 10, 2022 21:02
An example for fastify + fastify decorators and plugins (db connector, and so on)
// server.ts
import fastify from 'fastify';
import { bootstrap } from 'fastify-decorators';
const app = fastify()
// Note that this plugin adds a decorator to the fastify instance like: fastify.awesomePlugin(...)
app.register(require('some-awesome-plugin'))
app.register(bootstrap, {
@Shair17
Shair17 / consoleColors.js
Created May 16, 2020 06:39 — forked from abritinthebay/consoleColors.js
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"