Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shahzad Choudhary #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions controllers/notes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const Note = require("../models/Note");
1 change: 1 addition & 0 deletions controllers/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const User = require("../models/User");
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
app.listen(3000, () => console.log('app is running'))
const express = require("express");
const app = express();



app.listen(3000, () => console.log('app is running'));

// DO NOT REMOVE THIS LINE:
module.exports = app
10 changes: 8 additions & 2 deletions models/Note.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const mongoose = require('../db/connection')
const User = require("./User");

const noteSchema = new mongoose.Schema({})
const noteSchema = new mongoose.Schema({
title: String,
body: String,

module.exports = mongoose.model('Note', noteSchema)
author: [User]
});

module.exports = mongoose.model('Note', noteSchema);
10 changes: 8 additions & 2 deletions models/User.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const mongoose = require('../db/connection')
const Note = require("./Note");

const userSchema = new mongoose.Schema({})
const userSchema = new mongoose.Schema({
username: String,
email: String,

module.exports = mongoose.model('User', userSchema)
notes: [Note]
});

module.exports = mongoose.model('User', userSchema);
Loading