June 2018
Intermediate to advanced
348 pages
8h 19m
English
We have created a models folder in the root project directory. In this folder, we will create all the models for our application. Start creating the team.js file in the src/models folders:
$ touch src/models/team.js
Remember that we use the touch command to create a new file. Then, open this file, and from the src/config/mongoose-connection.js file, cut the following lines and copy them into the src/models/team.js file, as follows:
const mongoose = require('mongoose')const TeamSchema = new mongoose.Schema({ name: { type: String, min: 3, max: 100, required: true, unique: true }, ranking: { type: Number, min: 1 }, captain: { type: String, required: true }, Trainer: { type: String, required: true }, confederation: { ...Read now
Unlock full access