A basic RESTful application with HATEOAS using Node.js, Express and MongoDB.
You'll need the community edition of MongoDB install before running this application. To do this run the following commands in terminal:
brew update
brew tap mongodb/brew
brew install mongodb-community
After installing MongoDB, you'll have to manually create where it saves the databases. This is thanks in part to changes made in macOS 10.15. To do this run the following command in terminal:
sudo mkdir -p /data/db
Next, you'll want to let MongoDB know where this is. To do this with Visual Studio Code, open up the config file as such:
code /usr/local/etc/mongod.conf
Now make the following change, replacing <username>
with your username:
storage:
dbPath: /Users/<username>/data/db
Before we can start using the application we'll also need to install a dummy database. From terminal run:
mongo bookAPI < booksJson.js
yarn
yarn build
After build the application and installing MongoDB, start the application by running the following in terminal:
yarn start