![]() ![]() ![]() In our setup function, we commit the GetAllQuotes mutation. Once the components mount, we would like to get all our quotes, so we import useStore and onMounted from vuex since we are using the composition API instead of options API. So in our App.vue we set our Home and All quotes route. In our app.js after our dependencies have been required, copy and paste the following code to connect our database. In this page, under your cluster name, click on the connect button and follow the steps and you will get your connection string that can be used to connect to the application.įor detailed explanation on how to setup your cluster, go here. Click on create cluster, and you will be taken to another page. You can choose to change the cluster name. Then create a cluster, choose the free tier cluster, then create the cluster. Students will learn how to create CRUD (create, read, update, delete) operations for different schema types, and how to handle relationships between different schemas. You first have to create an account on their site. The course will also cover using MongoDB Cloud as the database for the API, and how to use the Mongoose schema to interact with the database. We are going to be using mongodb atlas instead of downloading it locally. const express = require("express")Ĭonst bodyParser = require("body-parser") We iniatilize our express app then listen at port 3000 for any incoming request. ![]() In our backend folder, we create a file named app.js and in that file we require express, mongoose and bodyparser. npm install express body-parser mongoose cors -saveĪnd in the package.json script add "start": "nodemon app.js" Installing dependenciesįor our server we need to install express, bodyparser, mongoose and cors. In our backend folder, we run npm init -y First, we create our project folder, name it quote-app, then in our quote-app directory, we create our backend folder, name it backend.
0 Comments
Leave a Reply. |