-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo.js
38 lines (31 loc) · 811 Bytes
/
mongo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const express = require('express');
const mongoose = require('mongoose');
const app = express();
app.use(express.urlencoded({ extended: true }));
mongoose.connect("mongodb://0.0.0.0:27017/signUP", { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => {
console.log('mongodb connected');
})
.catch((err) => {
console.error('Error connecting to MongoDB:', err);
});
const signUPSchema = new mongoose.Schema({
name: {
type: String,
required: true
},
phoneNumber: {
type: Number,
required: true
},
username: {
type: String,
required: true
},
password: {
type: String,
required: true
}
});
const signUP = mongoose.model('signUP', signUPSchema);
module.exports = signUP;