The front end uses Vue
npm install
npm run dev
npm run build
Steps taken to create this API.
- Run "dotnet new webapi -o ." to create new web api project in current folder
- Install dependencies "dotnet add package {package name}"
- MongoDB.Driver for connecting to MongoDB Atlas
- DotNetEnv for storing our MongoDB connection URI within a .env file to keep it hidden on GitHub
- Define MongoDB settings in appsettings.json
- The ConnectionString will come from the .env file that is ignored on github within the .gitignore file
- Create MongoDBSettings.cs class and add database settings ready to be linked in Program.cs
- Create new folder called Models and add a C# class file called book
- The book model has an Id, bookname, author, and isread
- Create MongoDB service to get the booklist collection
- Create one simple Get route service that returns all books in the DB
- Create BooklistController within Controllers folder
- This file holds all the Http requests and points them to the service code
- Add a line of code to link the MongoDBSettings class to the appsettings.json
- Add a line of code to add the BooklistService to the application so it can be used
- Before adding more routing the API will be tested to see it the MongoDB connection is working with the .env file
- Run application using "dotnet run"
- Because the api project was made using dotnet webapi we can go to the swagger interface to test this "localhost:0000/swagger"
- Run "npm create vue@latest" in app directory
- Install cors into the .NET backend to accept http requests from our front end