NPM packages - bommezijn/Dating-Shreks GitHub Wiki
Written by Parvin.
NPM Packages
During our project, we installed multiple npm packages and along the road, we wouldn't know how we would do without them. So here comes al of our npm packages with some explanation or a story.
Developer Dependencies
Let's start out with the Developer Dependencies. This is where you install npm packages which help you code in a certain way (think of a linter), automatically restarts the server (think of nodemon) & make it easier to read your code (think of prettier). Below you'll find a list of developer dependencies (devDependencies)
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.20.2",
"nodemon": "^2.0.4",
"prettier": "2.0.5"
}
eslint(-config-google & -plugin-import) = a linter that can be used to force a certain way of coding. This is something which is very handy when you are working in big groups. You can find more information at our linter research.
nodemon = this is a dependency which automatically restarts your server so you don't have to do this manually. Without this dependency, our lives would be waayyyyyy worse.
prettier = this is an opinionated code formatter that helps you write cleaner code. It doesn't really do much more than this and I think they don't want to either.
All the other Dependencies
These are all the npm packages we use in our project. These dependencies can be used to write certain code which otherwise wouldn't be supported. You would install these packages because you would want to do certain things within your project. Below you see all the dependencies:
"dependencies": {
"body-parser": "^1.19.0",
"dotenv": "^8.2.0",
"connect-mongodb-session": "^4.17.1",
"express-handlebars": "^4.0.4",
"express-session": "^1.17.1",
"mongodb": "^3.5.8",
"node-fetch": "^2.6.0",
"slug": "^3.0.1"
}
Let's go over these dependencies from top to bottom:
body-parser = This npm package is used to request things you type into a form. You can call it by typing:
req.body.WHAT_YOU_WANT_TO_REQUEST
dotenv = This is used to load elements and variables from .env into your js file. You can call it by typing:
process.env.THE_VARIABLE_INSIDE_.ENV
connect-mongodb-session = This is used to let express and sessions work together really well.
express-handlebars = Handlebars which perfectly works with our express project. Handlebars is a templating tool. You can find more information about that our templating research.
express-session = MongoDB, express and session in perfect harmony.
mongodb = MongoDB is an easy way you can connect to a database and store things inside it. Also, it's free!
node-fetch = This is installed because Parvin was working with fetch. This is a method that lets you get data from a different database than your own.
slug = Slugifies strings, even when they contain Unicode.
helmet = makes the website safer against particular attacks by adding/removing certain HTTP headers.
These are all the npm packages we use. I hope you enjoyed reading this. For mistakes or anything else: write an issue so we can fix it.
Sources
Eslint - a linter for JS. (z.d.). Geraadpleegd op 20 juni 2020, van https://eslint.org
Handlebars. (z.d.). Geraadpleegd op 20 juni 2020, van https://handlebarsjs.com- https://www.npmjs.com/package/mongodb
Nodemon. (z.d.). Geraadpleegd op 20 juni 2020, van https://nodemon.io
Npm: body-parse. (2018, 6 september). Geraadpleegd op 20 juni 2020, van https://www.npmjs.com/package/body-parser
Npm: connect-mongodb-session. (2020, 10 juni). Geraadpleegd op 20 juni 2020, van https://www.npmjs.com/package/connect-mongodb-session
Npm: dotenv. (2019, 16 oktober). Geraadpleegd op 20 juni 2020, van https://www.npmjs.com/package/dotenv
Npm: express-handlebars. (2020, 29 april). Geraadpleegd op 20 juni 2020, van https://www.npmjs.com/package/express-handlebars
Npm: express-session. (2020, 17 april). Geraadpleegd op 20 juni 2020, van https://www.npmjs.com/package/express-session
Npm: node-fetch. (2019, 16 mei). Geraadpleegd op 19 juni 2020, van https://www.npmjs.com/package/node-fetch
Npm: slug. (2020, 30 mei). Geraadpleegd op 20 juni 2020, van https://www.npmjs.com/package/slug
Prettier ยท Opinionated Code Formatter. (z.d.). Geraadpleegd op 4 juni 2020, van https://prettier.io