Loopback Component Current User
This loopback component enables you to add the logined(current) user to the request of thhe loopback application.
Installation
- Install in you loopback project:
npm install --save loopback-component-current-user
-
Create a component-config.json file in your server folder (if you don't already have one)
-
Configure options inside
component-config.json
:
user
- [String] : The name of the user model. (default: 'User')
-
Create a middleware.json file in your server folder (if you don't already have one).
-
Ensure that you enable the
loopback#token
middleware early in your middleware chain.
Usage
Model