Skip to content

Instantly share code, notes, and snippets.

View trylovetom's full-sized avatar
♥️
Falling in Love with JavaScript~

CHANG, TZU-YEN trylovetom

♥️
Falling in Love with JavaScript~
View GitHub Profile
@trylovetom
trylovetom / better-nodejs-require-paths.md
Created August 8, 2017 09:20 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions