- Create
.env
referring.env_example
- DB_NAME= name of database
- COLLECTION_NAME= collection name
- SERVER_PORT= port number
- VI_LENGTH= length of verifyId
- VALID_DURATION_MIN= how long user are available to verify after preRegister
- MONGO_URL= URL for mongo
- Set up node environment
- Run
npm install
- Run
npm start
- Run
All of them are POST
method.
preRegisterUser
Provideuser
andpassword
. You will getverifyId
. Until you verify the user,status
of the user is0
.verifyUser
ProvideverifyId
frompreRegisterUser
,user
andpassword
. We will register the user.status
of the user will become1
. You need to call it withinVALID_DURATION_MIN
minutes after callingpreRegisterUser
.changeUser
Provideuser
,password
andnewUser
. Ifuser
's password ispassword
andnewUser
doesn't exist, we will rename the user tonewUser
.changePassword
Provideuser
,password
andnewPassword
. Ifuser
's password ispassword
, we will change password tonewPassword
.registerUser
Provideuser
andpassword
. We will register it. You don't need to callverifyUser
.status
of the user is1
by default.removeUser
Provideuser
andpassword
. We will remove the user ifuser
's password ispassword
.getUserInfo
Provideuser
andpassword
(Optional). We will return the user's information. Ifpassword
is correct,info.secretCorrespond
should be true.
test/registration.js
will be helpful to know detail. You need to run npm start
before running npm run test
.