7

Model-View-Controller - , .

MVC, , , .


Model View Controller

MVC 1979 . , .

MVC Small Talk. Model-View-Editor, Model-View-Controller.

1980- 90- MVC . 1990- -. - MVC .

-, MVC:

  • Ruby on Rails
  • ASP.NET MVC
  • Laravel
  • Angular

MVC?

MVC :

  • Model ,
  • View ,
  • Controller

MVC -?

, MVC, .

MERN (MongoDB, Express, React, Node) .

, , Covid, .

, .


Model

. MongoDB .

, . name, email, program, application, backgroundCheck, tbTest covidTest.

const coachSchema = new Schema({
    name: {
        type: String,
        trim: true,
        maxLength: 32,
        required: true
    },
    email: {
        type: String,
        trim: true,
        maxLength: 32,
        required: true,
        unique: true
    },
    program: {
        type: String,
        trim: true,
        maxLength: 32,
        required: true
    },
    application: {
        type: Boolean,
        required: true
    },
    backgroundCheck: {
        type: Boolean,
        required: true
    },
    tbTest: {
        type: Boolean,
        required: true
    },
    covidTest: {
        type: Boolean,
        required: true
    }
}, { timestamps: true })

type: Boolean true false , backgroundCheck, tbTest covidTest.

, false, , .

, MongoDB Atlas.

.

""" .


View

View (, ) . React.

.

View Dashboard .

, . , .

-

, (fetch) :

await fetch('https://mvc-project-backend.herokuapp.com/coaches')

map(), , .

    coachData.map(data => (
                        <tr key={data._id}>
                          <td>{data.name}</td>
                          <td>{data.email}</td>
                          <td>{data.program}</td>
                        </tr>
                      ))

, , , Covid .

map().

Send reminder email, React- . , .

, , View .


Controller

. Node.JS Express.

. , .

, .

, .

Nodemailer:

   transporter.sendMail(mailOptions, (err) => {
        if (err) {
            console.log(`Applications: There was an error sending the message: ${err}`)
            res.json({ status: 'Email failure' })
        } else {
            console.log(`Applications Success: Email was sent`)
            res.json({ status: "Email sent" });
        }
    })	

, , .

, , .


:

  • Model-View-Controller - , .
  • MVC , 1990- -.
  • , .
  • - , .
  • .
  • -, MVC - Ruby on Rails, ASP.NET MVC, Laravel Angular.

50% Merion Academy