공태현

Install mongoose and Write user-schema

1 +const mongoose = require('mongoose');
2 +
3 +const userSchema = new mongoose.Schema({
4 + name : {type : String, required : true, unique : true, },
5 + password : {type : String, required : true, trim : true},
6 +});
7 +
8 +
9 +module.exports = mongoose.model('squartuser', userSchema )
10 +
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 "main": "server.js", 5 "main": "server.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 - "start" : "node server.js" 8 + "start": "node server.js"
9 }, 9 },
10 "repository": { 10 "repository": {
11 "type": "git", 11 "type": "git",
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
14 "author": "", 14 "author": "",
15 "license": "ISC", 15 "license": "ISC",
16 "dependencies": { 16 "dependencies": {
17 - "express": "^4.18.1" 17 + "express": "^4.18.1",
18 + "mongoose": "^6.3.4"
18 } 19 }
19 } 20 }
......