diff options
Diffstat (limited to 'services/users')
-rw-r--r-- | services/users/user.model.js | 6 | ||||
-rw-r--r-- | services/users/user.schema.js | 14 | ||||
-rw-r--r-- | services/users/user.service.js | 7 |
3 files changed, 27 insertions, 0 deletions
diff --git a/services/users/user.model.js b/services/users/user.model.js new file mode 100644 index 0000000..74a83ae --- /dev/null +++ b/services/users/user.model.js @@ -0,0 +1,6 @@ +const { model } = require('mongoose'); +const userSchema = require('./user.schema.js'); + +module.exports = model('User', userSchema); + + diff --git a/services/users/user.schema.js b/services/users/user.schema.js new file mode 100644 index 0000000..f2c98ef --- /dev/null +++ b/services/users/user.schema.js @@ -0,0 +1,14 @@ +const { Schema } = require('mongoose'); + +module.exports = new Schema({ + username: { + type: String, + unique: true, + required: true + }, + password: { + type: String, + required: true + } +}, { timestamps: true }); + diff --git a/services/users/user.service.js b/services/users/user.service.js new file mode 100644 index 0000000..67f2ae6 --- /dev/null +++ b/services/users/user.service.js @@ -0,0 +1,7 @@ +const service = require('feathers-mongoose'); +const Model = require('./user.model.js'); + +const UserService = service({ Model }) + +module.exports = app => app.use('/users', UserService); + |