Skip to content

Instantly share code, notes, and snippets.

@jugshaurya
Last active September 24, 2019 05:47
Show Gist options
  • Save jugshaurya/e8f17823e58befc8cfdb8ae81f1c6da1 to your computer and use it in GitHub Desktop.
Save jugshaurya/e8f17823e58befc8cfdb8ae81f1c6da1 to your computer and use it in GitHub Desktop.
npmCLI, ENV-variables
# npm CommandLine
1. Initialize node repo
$ npm init
2. To see the recurive-list of dependences for your project in a graph like structure
$ npm list
npm list --depth=0
- to see only toplevel dependencies
3. $ npm i
npm i -g package 'or' npm i -g <package>@<version> to install globally
npm i package 'or' npm i <pacakge>@<version> to install locally
npm i package --save-dev'or' npm i <pacakge>@<version> --save-dev to install as dev-dependencies
4. Updating Local Packages
- See outdated Packages
- $ npm outdated
- $ npm update - updates only minor and patch things of version SemVer(Semantic Versoning)
- install 'npm-check-update' globally to update major part of SemVer and run
- $ ncu -u
5. Uninstalling Packages
$ npm un
6. Publishing packages and updating once made changes
$ npm adduser or npm login
$ npm publish
- Updating published Version
$ npm version major/minor/patch - increases major or minor or patch by 1 depending on option u give in package.json
$ npm publish
7. Viewing Registry info of a package
$ npm view <package>
$ npm view <package> dependencies
$ npm view <package> version
# Environmental Variables
- Used to store various Setting for an application.
- Setting them - $ set <VARNAME>=<VALUE> - in linux
- Clearing them - $ set <VARNAME>=
- process.env.PORT
# Mongodb
MongoDB is a NoSQL database that offers high performance, high availability and automatic scaling of the enterprise level database. MongoDB is a NoSQL database, so you cannot use SQL (Structured Query Language) to insert and retrieve data, and it does not store data in tables like MySQL or Postgres. The data is stored in a "document" structure in JSON format (called BSON in MongoDB). MongoDB was introduced in 2009 and is currently being developed by MongoDB Inc
Installation:
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04
more..
bydefault mongo save it data in /data/db
so we make it and add permisson to it
$ mkdir -p /data/db
$ sudo chown -R `id -un` /data/db
installing mongodb compass(GUI) for ubunutu
https://docs.mongodb.com/compass/master/install/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment