diff --git a/README.md b/README.md index 5419a54..5f7e18d 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -# Fibonacci REST API demo +# Fibonacci REST API Demo ## Requirements - Node.js 12+ - Vue 4.5+ - MongoDB - ## Description -This is a web application for calculating fibonacci numbers and displaying all previous results. The front end is written in Vue.js as the Javascript framework and bootstrap for css styling, while the backend uses Node's Express.js server with mongoDB as the database. I deployed the website here: link. But if you want to run the website locally, go to "how to install and run locally" section. - +This is a web application for calculating fibonacci numbers and displaying all previous results. The front end is written in Vue.js as the Javascript framework and bootstrap for css styling, while the backend uses Node's Express.js server with mongoDB as the database. Click [here](https://peaceful-brook-94145.herokuapp.com) to view the deployed website. But if you want to run the website locally, go to the "How to install and run locally" section. +
## Design Choice -I chose Express.js as it is fairly minimalist for fast setup and it provides middleware packages that address most web development issues. MongoDB is a no brained as it is the best option for a non-relational database, which suites this use case for storing only Fibonacci numbers and a few attributes. As for Vue.js, I chose it because I had previous development experience with it and it is fast and simple to setup. +I chose Express.js as it is fairly minimalistic for fast setup and it provides middleware packages that address most web development issues. MongoDB is a no brained as it is the most popular and best option for non-relational database, which suites this use case for storing only Fibonacci number and two other attributes. As for JS framework, I chose Vue.js because I had previous development experience with it and it is fast and simple to setup. +
## How to install and run locally -1) Clone the dev branch into your local depository. Change "myproject" to your project name. +#### 1) Clone the dev branch into your local depository. Change "myproject" to your project name. ```bash @@ -26,7 +26,7 @@ git clone --branch dev https://github.com/chenterry85/Fibonacci-REST.git ./mypro ``` -2) Install npm dependencies +#### 2) Install npm dependencies ```bash cd myproject @@ -38,15 +38,27 @@ npm update cd client npm install npm update + +# navigate back to main directory +cd .. ``` -3) Run the Express server +#### 3) Add environment variables +##### Create `.env` file with the following environment variables +- Port: `5555` +- MongoDB's Database URI: `mongodb+srv://mongouser:mongo6868@cluster0.ipnoi.mongodb.net/fib_db?retryWrites=true&w=majority` +```bash +echo -e "PORT=5555\nDB_URI=mongodb+srv://mongouser:mongo6868@cluster0.ipnoi.mongodb.net/fib_db?retryWrites=true&w=majority" > .env +``` + +#### 4) Run the Express server ```bash npm start ``` -4) Run the Vue.js client +#### 5) Run the Vue.js client +Open a new terminal session and in that new session run: ```bash cd client npm run serve -``` \ No newline at end of file +``` diff --git a/server/routes/fibs.js b/server/routes/fibs.js index 5d547a6..2446f08 100644 --- a/server/routes/fibs.js +++ b/server/routes/fibs.js @@ -7,7 +7,6 @@ const router = express.Router(); // Get all Fibonacci numbers router.get('/', async (req, res) => { try{ - console.log("getting fibs") const fibNums = await FibNum.find().sort({$natural:-1}); res.status(200).json(fibNums); }catch(err){