헤더

git working Directory -Staging Area-Git repository(Local)

Posted by 소상공인 손실보상 정책자금 대출
2021. 1. 4. 21:18 웹개발
test11`````````````````````````

git init

git 저장소 만들어줌 

 

$git status

 

./gitignore 파일 생성

node_modules 작성

 

$git add .

$git status

 

$git commit -m " 처음저장소에 올림"

 

'웹개발' 카테고리의 다른 글

MongoDB User.js 유저 정보 관리  (0) 2021.01.04
MongoDB MongooseServerSelectionError  (0) 2021.01.04
test22`````````````````````````

MongoDB User.js 유저 정보 관리

Posted by 소상공인 손실보상 정책자금 대출
2021. 1. 4. 20:23 웹개발
test11`````````````````````````

model은 스키마를 감싸주는 역활

const mongoose = require('mongoose')

const userSchema = mongoose.Schema({

 

name:{

type : String,

maxlength: 50

},

email:{

 

type: String,

trim : true,

unique: 1

},

lastname : {

type : String,

maxlength: 50

 

},

role : {

type : Number,

default : 0

},

image : String,

token : {

type : String

},

tokenExp : {

type : Number

}



})

 

const User = mongoose.model('User',userSchema) //모델의 이름적용 스키마를 감싸줌

module.exports = {User}//다른파일에서도 사용할 수 있게 

 

 


email type 이메일 내에 빈칸 공백 없애준다.

unique 값을 1로 설정 하나의 이메일로만 사용

 

role의 역활 관리자와 일반유저 나누기 위해서

ex 1이면 관리자 0이면 일반 유저 

 

token 사용기간 만료 설정

 

 

'웹개발' 카테고리의 다른 글

git working Directory -Staging Area-Git repository(Local)  (0) 2021.01.04
MongoDB MongooseServerSelectionError  (0) 2021.01.04
test22`````````````````````````

MongoDB MongooseServerSelectionError

Posted by 소상공인 손실보상 정책자금 대출
2021. 1. 4. 19:30 웹개발
test11`````````````````````````

 

 

 

(base) apple-ui-MacBook-Pro:boiler-plate apple$ npm run start

Debugger attached.

 

> boiler-plate@1.0.0 start

> node index.js

 

Debugger attached.

Example app listening at http://localhost:5000

MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/

    at NativeConnection.Connection.openUri (/Users/apple/Documents/boiler-plate/node_modules/mongoose/lib/connection.js:832:32)

    at /Users/apple/Documents/boiler-plate/node_modules/mongoose/lib/index.js:345:10

    at /Users/apple/Documents/boiler-plate/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5

    at new Promise (<anonymous>)

    at promiseOrCallback (/Users/apple/Documents/boiler-plate/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)

    at Mongoose._promiseOrCallback (/Users/apple/Documents/boiler-plate/node_modules/mongoose/lib/index.js:1135:10)

    at Mongoose.connect (/Users/apple/Documents/boiler-plate/node_modules/mongoose/lib/index.js:344:20)

    at Object.<anonymous> (/Users/apple/Documents/boiler-plate/index.js:6:10)

    at Module._compile (node:internal/modules/cjs/loader:1108:14)

    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)

    at Module.load (node:internal/modules/cjs/loader:973:32)

    at Function.Module._load (node:internal/modules/cjs/loader:813:14)

    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)

    at node:internal/main/run_main_module:17:47 {

  reason: TopologyDescription {

    type: 'ReplicaSetNoPrimary',

    setName: null,

    maxSetVersion: null,

    maxElectionId: null,

    servers: Map(3) {

      'boilerplate-shard-00-02.zhyvn.mongodb.net:27017' => [ServerDescription],

      'boilerplate-shard-00-00.zhyvn.mongodb.net:27017' => [ServerDescription],

      'boilerplate-shard-00-01.zhyvn.mongodb.net:27017' => [ServerDescription]

    },

    stale: false,

    compatible: true,

    compatibilityError: null,

    logicalSessionTimeoutMinutes: null,

    heartbeatFrequencyMS: 10000,

    localThresholdMS: 15,

    commonWireVersion: null

  }

}

 

Network Access 

 

 

'ADD IP ADDRESS' Click 

 

Add your IP

'웹개발' 카테고리의 다른 글

git working Directory -Staging Area-Git repository(Local)  (0) 2021.01.04
MongoDB User.js 유저 정보 관리  (0) 2021.01.04
test22`````````````````````````