/Project-13-Bank-API

P13 BACK

Primary LanguageJavaScript

Project #13 - Argent Bank API

This codebase contains the code needed to run the backend for Argent Bank.

Getting Started

Prerequisites

Argent Bank uses the following tech stack:

Please make sure you have the right versions and download both packages. You can verify this by using the following commands in your terminal:

# Check Node.js version
node --version

# Check Mongo version
mongo --version

Instructions

  1. Fork this repo
  2. Clone the repo onto your computer
  3. Open a terminal window in the cloned project
  4. Run the following commands:
# Install dependencies
npm install

# Start local dev server
npm run dev:server

# Populate database with two users
npm run populate-db

Your server should now be running at http://locahost:3001 and you will now have two users in your MongoDB database!

Populated Database Data

Once you run the populate-db script, you should have two users in your database:

Tony Stark

  • First Name: Tony
  • Last Name: Stark
  • Email: tony@stark.com
  • Password: password123

Steve Rogers

  • First Name: Steve,
  • Last Name: Rogers,
  • Email: steve@rogers.com,
  • Password: password456

API Documentation

To learn more about how the API works, once you have started your local environment, you can visit: http://localhost:3001/api-docs

Design Assets

Static HTML and CSS has been created for most of the site and is located in: /designs.

For some of the dynamic features, like toggling user editing, there is a mock-up for it in /designs/wireframes/edit-user-name.png.

And for the API model that you will be proposing for transactitons, the wireframe can be found in /designs/wireframes/transactions.png.

More

Do you struggle to install the API on macOS ?

If you have the error [nodemon] app crash... you probably didn't install MongoDB Community Edition. And don't worry if the mongo --version is not working....

What I did to fix the error:

  1. Follow this link for complete instructions https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/
  2. If you don't have home brew package manager installed (global) then: https://brew.sh/index_fr

So once brew is installed, in your macOS terminal: you can run:

  1. brew tap mongodb/brew

  2. brew install mongodb-community@6.0

⚠️ like me, you can have this error:

image

If you had it just follow the img instructions (so install xcode-select) and then launch again brew install mongodb-community@6.0

  1. now you can check the install with mongod --version

  2. and then run mongodb community with brew services start mongodb-community@6.0

(to stop it : brew services stop mongodb-community@6.0)

Now, you can clone the repo and:

  1. npm i
  2. add MongoDB NodeJS Driver npm install mongodb --save
  3. Start your local server npm run dev:server
  4. Get the populate database npm run populate-db

✨ Your Api should be ready 😃

👉 http://localhost:3001/api-docs/

Hope it helps ! 👋