I have created a feature that allows you to add interests to your profile. It consists of 3 questions about your interest. You can answer this and it will appear on your profile
I use mongodb in combination with mongoose. My database is hosted with mongo atlas and I used mongoDB Compass to display my data.
-
Clone the repository
git clone https://github.com/Jeroen777/JeroenBackendHer
-
Choose the correct folder where you want to clone it
cd backend/
-
Make a .env file
touch .env
-
The .env file has the following structure
DB_URI=
DB_USER=
DB_PASS=
DB_NAME=
-
Install the packages
npm install
-
Start the server
node server.js
const mongoose = require('mongoose');
//Structure in the collection
const Schema = mongoose.Schema;
//https://mongoosejs.com/docs/guide.html
//Schema structure how to save in the collection
//Objects with a string and all are required
const infoSchema = new Schema({
vraagEen: {
type: String,
required: true
},
vraagTwee: {
type: String,
required: true
},
vraagDrie: {
type: String,
required: true
}
});
//mongoose model, Info terugvinden, model gebaseerd op de Schema
//export to use in server.js
const Inter = mongoose.model('Inter', infoSchema);
module.exports = Inter;
This project is licensed under the ISC license. See the LICENSE.MD file for more information.
- https://scotch.io/courses/create-a-crud-app-with-node-and-mongodb/environment-variables
- https://mongoosejs.com/docs/guide.html
- https://ejs.co/
- https://medium.com/@LindaVivah/the-beginners-guide-understanding-node-js-express-js-fundamentals-e15493462be1#:~:text=What%20is%20Express%3F,open%20source%20and%20flexible%20Node.
- https://www.robinwieruch.de/mongodb-express-setup-tutorial
- https://expressjs.com/
- https://www.npmjs.com/get-npm
- https://stackoverflow.com/questions/6528876/how-to-redirect-404-errors-to-a-page-in-expressjs
- http://expressjs.com/en/api.html
- https://stackoverflow.com/questions/43016478/casterror-cast-to-objectid-failed-for-value-favicon-ico-at-path-id-for-mod