Skip to content

9. Working on the Web Jam Backend Repo

Joshua V Sherman edited this page Mar 23, 2020 · 2 revisions

9.1 NodeJS and Express

If you ever run into an error where a node-express instance is already in use, this command works great:

killall node

https://stackoverflow.com/questions/4075287/node-express-eaddrinuse-address-already-in-use-kill-server

9.2 Working with MongoDB

9.2.1 mLAB

More mLab info is coming soon ...

Get the credentials for mLab from joshua.v.sherman@gmail.com and put them into your .env file

9.2.2 MongoDB at Localhost

If desiring to run MongoDB locally for testing, then follow the installation instructions at mongodb.com

For the backend .env use the following:
Mongodb_URI=localhost

Open a Terminal, type mongo --shell

Commands to know:

show dbs - shows all databases
show collections - shows each model in the database
db.collection.find() - will find all records in the collection, for example db.books.find()
db.collection.drop() - will drop or delete all records from the collection, for example db.books.drop()