File tree Expand file tree Collapse file tree
examples_new/microservices/auth/src/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { DbConnectionError , errorHandler } from " @chronosrx/common" ;
1+ import { DbConnectionError , errorHandler } from ' @chronosrx/common' ;
22const mongoose = require ( 'mongoose' ) ;
33require ( 'dotenv' ) . config ( ) ;
44
55const MONGO_URI = process . env . MONGO_URI ;
66
77mongoose
8- . connect ( MONGO_URI , {
8+ . connect ( MONGO_URI , {
99 useNewUrlParser : true ,
1010 useUnifiedTopology : true ,
11- } )
12- . then ( ( ) => console . log ( `Connected to MongoDB Database` ) )
13- . catch ( ( err ) => { throw new DbConnectionError ( ) } ) ;
11+ } )
12+ . then ( ( ) => console . log ( `Connected to MongoDB Database` ) )
13+ . catch ( err => {
14+ throw new DbConnectionError ( ) ;
15+ } ) ;
1416
1517const Schema = mongoose . Schema ;
16- const
18+ const UserSchema = new Schema ( {
19+ username : { type : String , require : true } ,
20+ password : { type : String , require : true } ,
21+ } ) ;
22+
23+ const User = mongoose . model ( 'User' , UserSchema ) ;
24+
25+ module . exports = { User } ;
You can’t perform that action at this time.
0 commit comments