git clone https://github.com/atakansn/nodejs-rest.git
cd nodejs-rest
Running in a Developer Environment
npm run dev
Configuration
Env File Editing
#Stack displays in the error output during development, if production is set, it is not displayed.NODE_ENV=development#Application SettingsAPP_NAME="Restfull Api"APP_PORT=3000APP_URL=http://localhostAPP_HOSTNAME=localhost#It is the hostname that ExpressJS uses.DB_HOST=127.0.0.1#mongodb hostDB_PORT=27017#mongodb portDB_NAME=#mongodb db name#If disk is selected, the uploaded image will be moved to public/images. If s3 is selected, the uploaded image will be uploaded to aws s3 cloud storage.FILE_UPLOAD=disk#It uses jwt for authentication. You must enter the secret keys here.JWT_ACCESS_SECRET_KEY=JWT_REFRESH_SECRET_KEY=#If FILE_UPLOAD field is selected as s3, aws settings must be made.AWS_S3_ACCESS_KEY_ID=AWS_S3_SECRET_ACCESS_KEY=AWS_S3_BUCKET=AWS_S3_REGION=AWS_S3_ACL=
API Usage
User Routes
The following routes can be used by logged in users.Bearer {token} is required on all routes.GET /api/v1/usersPATCH /api/v1/usersDELETE /api/v1/usersPATCH /api/v1/users/password-change
Request
Route
Descripiton
GET
/api/v1/users
Displays the logged in user's information.
PATCH
/api/v1/users
Updates user information. {first_name,last_name,email} any field can be updated.
DELETE
/api/v1/users
Deletes the user.
PATCH
/api/v1/users
Updates user password. {password} field is required.
POST /api/v1/usersPOST /api/v1/users/password-resetPOST /api/v1/users/password-reset/:tokenPOST /api/v1/users/login
Request
Route
Descripiton
POST
/api/v1/users
Creates a new user. {first_name,last_name,email,password} fields are required.
POST
/api/v1/users/password-reset
It sends a password reset link to the registered email address. The {email} field is required.
POST
/api/v1/users/login
User login. {email,password} fields are required.
POST /api/v1/users/password-reset/:token
Parameter
Type
Descripiton
token
string
It is the password reset link sent to the e-mail address, it receives an ?email query at the end.