🌱 Tao of Node

Source

I like this, makes it clear what your are looking at by the case. I don’t follow this with file names currently but want to change.

// 1. Use all caps for constants
const CACHE_CONTROL_HEADER = 'public, max-age=300'

// 2. Use camel case for functions and variables
const createUserHandler = (req, res) => {}

// 3. Use pascal case for classes and models
class AppError extends Error {}

// 4. use kebab case for files and folders -> user-handler.js
Pin dependency versions

This is often overlooked, but make sure you pin the NPM packages to the exact version that you’re using. Don’t rely on semantic versioning to ensure that you won’t be getting any breaking changes. This means that you will have to put a task in your backlog to do an audit and update packages every few months but safety is worth the manual work.

Yup been burned by this a lot.

Made by Brandon . If you find this project useful you can donate.