/jeroenBackendHer

Primary LanguageCSSISC LicenseISC

My feature

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

Database

I use mongodb in combination with mongoose. My database is hosted with mongo atlas and I used mongoDB Compass to display my data.

How to install

  1. Clone the repository git clone https://github.com/Jeroen777/JeroenBackendHer

  2. Choose the correct folder where you want to clone it
    cd backend/

  3. Make a .env file touch .env

  4. The .env file has the following structure
    DB_URI= DB_USER= DB_PASS= DB_NAME=

  5. Install the packages
    npm install

  6. Start the server node server.js

  7. Open the server on localhost:8000 Screenshot 2021-03-08 at 14 57 58

Mongoose model

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;

License

This project is licensed under the ISC license. See the LICENSE.MD file for more information.

Sources