├── README.md ├── command-line-cheatsheet.md ├── module-explainer.md ├── node-cheatsheet.md └── express-cheatsheet.md /README.md: -------------------------------------------------------------------------------- 1 | # Cheatsheets 2 | 3 | A set of cheatsheets and glossary terms that will be useful for completing the Node Girls workshops. 4 | 5 | * [Node Cheatsheet](https://github.com/node-girls/cheatsheets/blob/master/node-cheatsheet.md) 6 | * [Command Line Cheatsheet](https://github.com/node-girls/cheatsheets/blob/master/command-line-cheatsheet.md) 7 | -------------------------------------------------------------------------------- /command-line-cheatsheet.md: -------------------------------------------------------------------------------- 1 | # Command Line Cheatsheet 2 | 3 | A go-to list of simple commands for your terminal. 4 | 5 | 6 | | Term | Meaning | 7 | |-----------------------|----------------------------------| 8 | | `pwd` | Stands for "print working directory". Will tell you the path to the folder you are currently in. | 9 | | `cd ` | Stands for "change directory". Will move you into the folder specified. eg. `cd documents` or `cd documents/node-project` | 10 | | `cd ..` | Moves you back one folder, to the parent directory. | 11 | | `ls` | Lists all the files and folders in the current directory. | 12 | | `mkdir ` | Creates a new folder with the name specified. eg. `mkdir new-project` | 13 | | `touch ` | Creates a new file with the name specified. eg. `touch index.html` | 14 | | `rm ` | Removes the specified file. eg. `rm script.js` | 15 | -------------------------------------------------------------------------------- /module-explainer.md: -------------------------------------------------------------------------------- 1 | # Understanding 'modules' 2 | 3 | ## What's a module? 4 | Modules are just small programs you can integrate with the bigger program you are writing. 5 | 6 | Modules would be listed in your `package.json`. 7 | 8 | There are 3 types of modules. 9 | 10 | ### a. Node core module 11 | 'Core' Node modules come with Node automatically. 12 | Examples of common core modules are `http`, `fs` and `path`. 13 | 14 | There is a list of all the core modules and their methods on the Node.js website. 15 | 16 | ### b. Node 3rd-party module 17 | There are thousands of open-source, 3rd-party Node modules that other clever people have written. You can download useful 3rd-party modules (also known as "packages") from [npm](http://npmjs.com) (the node package manager). 18 | 19 | The npm website says: 20 | 21 | > npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing. 22 | 23 | The npm command-line tool comes automatically with Node. You can install 3rd-party packages on the command line, so no need to download from the npm website or anything. 24 | 25 | ### c. Modules you've written 26 | 27 | Also called a module, but slightly different from the first two. 28 | 29 | These are modules you write yourself in your code. We will talk about this later on in step 7. 30 | -------------------------------------------------------------------------------- /node-cheatsheet.md: -------------------------------------------------------------------------------- 1 | # Node Cheatsheet 2 | 3 | A glossary of terms for Node.js. 4 | 5 | 6 | | Term | Meaning | 7 | |----------------|----------------------------------| 8 | | `Node.js` | JavaScript for servers. | 9 | | `web server` | Program that processes requests for the internet via HTTP. | 10 | | `HTTP` | Short for HyperText Transfer Protocol. The set of standards for transferring files over the internet. | 11 | | `npm` | Package manager for Node.js. Allows you to install and publish open source Node projects. | 12 | | `npm package` | Open source Node project, published on npm. | 13 | | `npm init` | Command run in the terminal to initialise your Node project and create a package.json file. | 14 | | `npm install ` | Command run in the terminal to install an npm package. | 15 | | `npm install ` `--save` | Command run in the terminal to install an npm package, `--save` or `-S` instructs NPM to include the package inside of the `dependencies` section of your package.json automatically. [Refer Docs](https://docs.npmjs.com/cli/install). | 16 | | `npm install ` `--save-dev` | Command run in the terminal to install an npm package, `--save-dev` or `-D` instructs NPM to include the package inside of the `devDependencies` section of your package.json automatically. | 17 | | `npm install ` `--save-optional` | Command run in the terminal to install an npm package, `--save-optional` or `-O` instructs NPM to include the package inside of the `optionalDependencies` section of your package.json automatically. | 18 | | `package.json` | File holding various metadata about a Node project, such as project name, description or license information, installed packages (aka dependencies). Usually located in the root directory. Package.json cheatsheet [here](http://browsenpm.org/package-json). | 19 | | `dependencies` | Packages installed from npm that are necessary to run the project successfully. Listed in the package.json. | 20 | -------------------------------------------------------------------------------- /express-cheatsheet.md: -------------------------------------------------------------------------------- 1 | | Keyword | Explanation | 2 | |--------|:-------------------------------:| 3 | | client | A client requests services and information from the server. Typically, a client is a computer application, such as a web browser. | 4 | | dependencies | Dependencies are external code modules that are required to run your project. | 5 | | endpoint | The part of the URL which comes after `/`. For example: `/chocolate` is the "chocolate" endpoint. | 6 | | `express.static()` | The built-in Express middleware function that makes it possible to serve static assets. | 7 | | `get()` | The Express method used to set up a handler function in Express. Takes two parameters: the endpoint, and the handler function. | 8 | | handler function | A function that receives requests and tells the server how to respond to them. | 9 | | method | Method is another name for a function. | 10 | | middleware | A function (or functions) that are invoked by Express before your final request handler is executed. Middleware sits between a raw request and its final intended route. | 11 | | module | A module is a bit of reusable code, written by you or someone else, that can be imported into a Node.js project using require. | 12 | | npm | npm is a "package manager" for Node.js, meaning it allows you to easily install external modules (or chunks of code) published by others and use them in your project. | 13 | | `npm install [package-name]` | The terminal command used to install a package from npm. | 14 | | `package.json` | A `package.json` is the file used to store information about a Node.js project, such as its name and its dependencies. Read more [here](http://browsenpm.org/package.json). | 15 | | port | A port is a number that serves as an endpoint, determining where you can access your web application. | 16 | | request | A request is the message sent via HTTP from the client to the server, asking for information. | 17 | | `require()` | Require is used in Node.js to import functionality from another file or an external module. | 18 | | response | A response is the data sent back to the client from the server after an HTTP request is made. | 19 | | routing | The definition of application endpoints and how they respond to client requests. | 20 | | `--save` | When added to the end of an `npm install` command, `--save` adds that npm package to the `package.json` file. | 21 | | `send()` | The Express method used to send information back to the client from the server. Updates the response object. | 22 | | server | A web server is a software application which handles HTTP requests sent by the client, like web browsers, and returns web pages and information in response. | 23 | | static assets | Files such as HTML, CSS and JavaScript documents or images that you want to appear in the browser. | 24 | | `use()` | The method that tells Express to use a certain piece of middleware. | 25 | --------------------------------------------------------------------------------