Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/EQuimper/nodejs-api-boilerplate
/ functions
Functions
36 in github.com/EQuimper/nodejs-api-boilerplate
⨍
Functions
36
◇
Types & classes
12
↓ 24 callers
Method
generate
* Create a user * * @public * @param {Object} attrs of user * @returns {Object} a fake user
__mocks__/factories/user.factory.js:17
↓ 7 callers
Function
filteredBody
(body, whitelist)
src/utils/filteredBody.js:10
↓ 1 callers
Function
deleteUserSeed
()
src/seeds/user.seed.js:21
↓ 1 callers
Function
envConfig
(env)
src/config/constants.js:34
↓ 1 callers
Method
makePretty
* Make error pretty * * @static * @param {Array} errors - Array of error Object * @returns {Object} - errors - Pretty Object transform
src/services/error.js:53
↓ 1 callers
Function
userSeed
(count)
src/seeds/user.seed.js:5
Function
_hashPassword
* Hash the user password * * @private * @param {String} password - user password choose * @returns {String} password - hash password
src/models/user.model.js:131
Function
authenticateUser
* Authenticate the user * * @public * @param {String} password - provided by the user * @returns {Boolean} isMatch - password match
src/models/user.model.js:121
Function
clearAll
(req, res, next)
src/controllers/seed.controller.js:43
Function
clearSeedUsers
(req, res, next)
src/controllers/seed.controller.js:24
Method
constructor
(message, status, isPublic)
src/services/error.js:7
Method
constructor
* Creates an API error. * * @param {String} message - Error message. * @param {Number} status - HTTP status code of error. * @param {Boole
src/services/error.js:31
Function
create
(req, res, next)
src/controllers/post.controller.js:220
Function
create
(req, res, next)
src/controllers/user.controller.js:60
Function
createPost
* Create a post * * @public * @param {Object} args - Object contains title and text * @param {String} authorId - the author id * @retur
src/models/post.model.js:61
Function
createToken
* Generate a jwt token for authentication * * @public * @returns {String} token - JWT token
src/models/user.model.js:141
Function
decFavoriteCount
(postId)
src/models/post.model.js:86
Function
deletePost
(req, res, next)
src/controllers/post.controller.js:263
Function
favoritePost
(req, res, next)
src/controllers/post.controller.js:371
Method
generate
* Create a post * * @public * @param {Object} attrs of post * @returns {Object} a fake post
__mocks__/factories/post.factory.js:17
Method
generateList
* Return a list * * @public * @param {Number} count * @param {Object} If add more attributes * @returns {Array} List
__mocks__/factories/base.factory.js:14
Function
getById
(req, res, next)
src/controllers/post.controller.js:162
Function
getList
(req, res, next)
src/controllers/post.controller.js:91
Function
incFavoriteCount
(postId)
src/models/post.model.js:82
Function
isPostIsFavorite
* Check if post is favorite by current user. * * @param {String} postId - _id of the post * @returns {Boolean} isFavorite - post is fav
src/models/user.model.js:106
Function
list
* If you call list() with zero arguments, the destructuring fails, * because you can’t match an object pattern against undefined. * That can be
src/models/post.model.js:74
Function
logErrorService
(err, req, res, next)
src/services/log.js:16
Function
login
(req, res, next)
src/controllers/authentication.controller.js:50
Function
posts
* Favorite a post or unfavorite if already here * * @param {String} postId - _id of the post like * @returns {Promise}
src/models/user.model.js:84
Function
seedUsers
(req, res, next)
src/controllers/seed.controller.js:11
Function
slugify
* Slug the title and add this to the slug prop
src/models/post.model.js:95
Function
toAuthJSON
* Parse the user object in data we wanted to send when is auth * * @public * @returns {Object} User - ready for auth
src/models/user.model.js:156
Function
toJSON
* Parse the user object in data we wanted to send * * @public * @returns {Object} User - ready for populate
src/models/user.model.js:169
Function
toJSON
* Parse the post in format we want to send. * * @public * @returns {Post} Post Object
src/models/post.model.js:104
Function
updatePost
(req, res, next)
src/controllers/post.controller.js:323
Function
validator
(email)
src/models/user.model.js:19