Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Green authored and Richard Green committed Jan 18, 2023
1 parent d2d72a9 commit 524b465
Show file tree
Hide file tree
Showing 13 changed files with 2,851 additions and 1,268 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# mern
learning MERN
19 changes: 19 additions & 0 deletions config/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const mongoose = require("mongoose");
const config = require("config");
const db = config.get("mongoURI");
const connectDB = async () => {
try {
await mongoose.connect(db, {
useNewUrlParser: true,
useCreateIndex: true,
});

console.log("Connected to mongodb");
} catch (err) {
console.log("error in connecting db", err.message);

process.exit(1);
}
};

module.exports = connectDB;
3 changes: 3 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mongoURI": "mongodb+srv://limbo:[email protected]/myFirstDatabase?retryWrites=true&w=majority"
}
24 changes: 24 additions & 0 deletions modals/User.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const mongoose = require("mongoose");

const UserSchema = new mongoose.Schema({
name: {
type: String,
required: true,
},
email: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
avatar: {
type: String,
required: false,
},
date: {
type: Date,
default: Date.now,
},
});
1,268 changes: 0 additions & 1,268 deletions myfile.sh

This file was deleted.

Loading

0 comments on commit 524b465

Please sign in to comment.