This repository is a collective of opinionated and real-world examples of how you can use Node.js to build things.
This repository is structured in a specific way. Top-level directories are categories of applications - for example CLI
, server
, and utility
- that enable you to find the specific kind of example you're looking for. From there, subdirectories of the categories are specific modules, frameworks, or tools - for example, yargs
is a CLI framework, both express
and fastify
are web frameworks, and moment
is a utility. Inside of each of those directories exists project directories, where specific examples live. You can find a full list of these examples in the Examples section below.
Each example has a few things (if one doesn't, please let us know by creating an issue):
- Usable example code with comments.
- Passing tests.
- A README.md that explains what the example does and how to use it.
Command Line Interfaces (CLIs) are tools that can be accessed exclusively from the command line that generally serve some utility. There is a vibrant community of Node.js CLI utilities, ranging from packages to make it slightly easier to accomplish something to full frameworks for building CLI experiences.
- CLI
- yargs
- countEntriesInDirectory: A small command line tool that shows how to use yargs and Node.js together, leveraging Node.js's
path
andfs
modules to read a directory passed by the CLI user
- countEntriesInDirectory: A small command line tool that shows how to use yargs and Node.js together, leveraging Node.js's
- yargs
We genuinely appreciate folks who are trying to help out by lowering the barrier to understanding Node.js 🤗
Our baseline for all contributions is following the project's Code of Conduct.
If you'd like to contribute an example, we'd genuinely appreciate your help. , there's a few things we'll expect from any contribution of a new example:
- Correct directory structure. This means:
- Usable example code. This means:
- Comprehensive comments.
- Descriptive and readable variable names.
- Modern JavaScript.
- We use Jest for testing. Examples' tests should check these boxes:
- Tests should be written for all code that can be tested.
- Tests should be in the format of
<name-of-file-being-tested>.test.js
and should live alongside the files they're testing.
- Proper documentation. This means:
- A README.md that explains what the example does and how to use it, plus documents the examples dependencies.
- The README should include a title, description, instructions for usage, and instructions for running the test.
We're always willing to take on more tests or improvements to our existing tests. We use Jest, and actively leverage the onlyChanged
flag to reduce nosie in our CI.
This repository has a non-trivial amount of written content. If you're interested in helping provide clarity and context or otherwise improving our prose, we welcome your contributions.
We use All Contributors for this section of the README. Please ensure you have the
all-contributors-cli
installed if you're modifying it. See the All Contributors CLI Usage documentation for details on usage.
Tierney Cyren 💻 🖋 📖 |