https://batec2.github.io/adventurer-school-registration-system/
cd back-end
npm i
npm run dev
cd front-end
npm i
npm run dev
- Create database
- Create collections named courses and students in mongodb
Import data from dataset\courses.json and dataset\students.json
into mondodb using compass or mongosh
Required in back-end root
for local:
comment out: atlas url in back-end\database\ConnectDatabase.js
and replace with
const url = `mongodb://127.0.0.1:27017/${process.env.DB_NAME} `;
For atlas:
DB_NAME="Your DB name"
DB_USER="Your Username"
DB_PASS="Your Pass Word"
- React w/ github pages
- Axios + React Query to send requests
- React Router to move between pages
- Nodejs w/ render
- Mongoose to query the database
- MongoDb w/ atlas
Front-end sends axios requests to the Nodejs api to get data, the backend then sends a query to through mongoose the database where depending on the result, it will send a response back to the front-end.
Courses:
{
courseSymbol: { type: String, required: true },
courseNumber: { type: String, required: true },
startTime: Number,
description: String,
teacher: {
firstName: String,
lastName: String,
},
capacity: Number,
students: [
{
type: ObjectId,
ref: "students",
},
],
};
Students:
{
firstName: { type: String, required: true },
lastName: { type: String, required: true },
email: { type: String, required: true },
age: Number,
courses: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "courses",
},
],
}