Install nvm for managing versions. This allows you to install and switch between different Node versions.
Then install the latest version of Node with:
nvm install stable
To check which version you're using:
node --version
You'll want to install the following extensions for your editor:
- eslint to check your code for common errors as you type (settings are configured on a per repo basis through an .eslintrc file)
- Prettier to format your code. If we run this before PRs we don't have to argue about code formatting in PRs.
I like VS Code a lot. Has "IDE like" features for navigating code easily.
BC JavaScript Style Guide forked from the AirBnb guide.
- The learnyounode tutorial is the best tutorial to start with: https://nodeschool.io/#workshoppers
- Official docs has some good "guides": https://nodejs.org/en/docs/guides/
- ... and API docs
- Security best practices
- graphql-tools from the Apollo dev team: "GraphQL Tools is an npm package and an opinionated structure for how to build a GraphQL schema and resolvers in JavaScript, following the GraphQL-first development workflow."
- graphql-tools example app. Express app including authentication with Passport.
- dataloader from Facebook providing "a consistent API over various backends and reduce requests to those backends via batching and caching". You'll want to use this for code that goes into production.
- Modern JS Cheat Sheet
- MDN has the most trustworthy reference/docs for JS. When googling you'll end up here a lot of the time.
- Fun Fun Function Youtube channel
There is a philosophy "do one thing well" and of reusing code whenever possible. There are bigger packages but also a lot of small packages.
There are some obvious packages to use for some things. Such as:
- Lodash. JS has a smaller standard library than most languages. Lodash is the go-to for utility functions. Just make sure to check that the function you're using isn't included in JS already.
- Express is the most popular Node.js framework with the largest community. It extends Node making it more convenient for developing typical web applications. The framework is minimalistic. Functionality is added to it via other packages, which often come in the form of "middleware". Alternatives are Koa and hapi.
- Passport for authentication.
- AVA for unit testing.
Role management/access control: https://gist.github.com/facultymatt/6370903
When you don't know https://www.npmjs.com/ is the best place to start. Then evaluate the GitHub repo:
- Are there unit tests?
- Is the code good quality?
- How popular is it?
- Is it well maintained? (Note: Sometimes packages are so small that they are "complete" and maintenance isn't really necessary.)
- How is the documenation?
- Etc etc. The usual evaluating open source sofware deal...
- As a concise intro I like The Little MongoDB Book. It explains NoSQL/MongoDB concepts and the rationale for them in a pedagogical way. It's a much gentler introduction than the official docs.
- There are official online courses for free at https://university.mongodb.com/
There are various abstractions one can use on top of Mongo. As the query interface is actually in JavaScript I'd say it makes sense to at least initially stay "close to the metal" so as to understand what you're doing. You don't need an ORM as you don't have the object oriented vs relational model mismatch.
apollo or relay?