- Run and seed the Mongo database with sample data.
- Build and run the Backend API.
- Build and run the Frontend.
- Test the API calls to the database.
Starting from the repository root directory, setup and run the Mongo database.
Select your operating system to start the MongoDB database:
Windows
Run MongoDB database on Windows.
. ./startDbServer.cmdLinux/Mac
Make the script executable and run MongoDB database on Linux/Mac.
chmod +x start.DbServer.sh
./start.DbServer.shOpen a new terminal and connect to the database using the database client.
Select your operating system to start the MongoDB client:
Windows
Run the database client on Windows.
mongosh --port 3000 --authenticationDatabase adminLinux/Mac
Run the database client on Linux/Mac.
mongo --port 3000 --authenticationDatabase adminOnce connected to the database, run the following commands to populate the demo data.
load ('expressServer/src/createDB/createSampleData.js');
show dbs
use tutorialPlatform
show collections
db.tutorials.find()
db.comments.find()
load ('expressServer/src/createDB/createAdminUser.js');
show users
exitThis section combines the Backend API and Frontend sections.
Starting from the repository root directory, run the following commands to install npm packages, compile the node server, compile the angular server, run the backend and frontend.
npm install
npm run build
npm run startStarting from the repository root directory, install npm packages, compile the node server, run the unit tests, and run the node server.
The following commands installs the npm packages, then compiles the node server and copy the pages to out/src/pages.
npm install
npm run build --workspace=expressServerThere are both unit tests and integration tests for the backend API.
To run the unit tests, this step assumes the npm packages were installed using npm install in the previous step.
npm run test --workspace=expressServerTo run the integration tests, this step assumes the database and API server are running.
npm run e2etest --workspace=expressServerTo test the API calls to the database, this step assumes the database and API server are running.
Tutorial - GET all / POST - /app/tutorials
Tutorial - GET by Id - /app/tutorials/{tutorialId}
Comments - GET all / POST - /app/comments
Comments - GET by Id - /app/comments/{commentId}
The following command runs the node server on port 8080.
npm run start --workspace=expressServerStarting from the repository root directory, install npm packages, compile the Angular server, run the unit tests, and run the Angular server.
The following commands installs the npm packages, then compiles the server.
npm install
npm run build --workspace=tutorial-applicationTo run the unit tests, this step assumes the npm packages were installed using npm install in the previous step.
npm run test --workspace=tutorial-applicationThe following command runs the frontend server.
npm run start --workspace=tutorial-applicationTo test the frontend, backend, and the database, this step assumes the frontend, backend, and database are running.
Hifi Screen - Home Page
The following command removes the database files, the node_modules directory, and the compiled node server.
npm run clean --workspace=expressServerSelect your operating system to install the MongoDB shell.
Windows
Install the MongoDB shell on Windows using winget.
winget install -e --id MongoDB.ShellLinux/Mac
Install the MongoDB shell on Linux/Mac using brew.
brew install mongoshmongosh "mongodb+srv://tutorialplatformcluster.utubbq2.mongodb.net/" --apiVersion 1 --username dbAdmin --password testgit remote remove azure
git remote add azure https://tutorialplatformmac-f0e4a3faemd4b4e5.scm.westus-01.azurewebsites.net:443/tutorialplatformmac.git
git push azure personal/ansantan/Step-Up-PR5:masterThe expressServer project uses a standard Node.js REST API project structure.
Repository-Root/
│
├── expressServer/ (project-root)
│ ├── node_modules/
│ ├── out/ (The compiled server runs from the out directory.)
│ │ ├── src/
│ │ ├── pages/
│ │ ├── App.js
│ │ ├── AppServer.js
│ ├── src/
│ │ ├── model/
│ │ ├── example.model.ts
│ │ ├── routes/
│ │ ├── example.route.ts
│ │ ├── App.ts
│ │ └── AppServer.ts
│ ├── test/
│ │ ├── unit/
│ │ ├── integration/
│ ├── package.json
│ └── tsconfig.json
│
├── tutorial-application/ (project-root)
│ ├── public/
│ ├── src/
│ │ ├── app/
│ ├── package.json
│ └── tsconfig.json
│
├── package.json
├── start.DbServer.cmd
├── start.DbServer.sh
├── startDbClient.admin.cmd
├── startDbClient.PopulateSampleData.cmd
├── .gitignore
└── README.md