@universal-packages/express-controllers-authentication
v1.9.0
Published
universal-authentication implementation on top of universal-express-controllers.
Downloads
1,628
Readme
Express Controllers Authentication
universal-authentication implementation on top of universal-express-controllers
Install
npm install @universal-packages/express-controllers-authentication
npm install @universal-packages/express-controllers
Global methods
initialize(options: Object, [authenticatableClass: AuthenticatableClass])
Initialize the authentication api and the authentication controller to prepare routing configuration before the ExpressControllers
runs. The authentication controller is loaded automatically by ExpressControllers
.
import { ExpressControllers } from '@universal-packages/express-controllers'
import { initialize } from '@universal-packages/express-controllers-authentication'
import User from './User'
await initialize({ secret: 'my-secret' }, User)
const app = new ExpressControllers({ port: 3000 })
await app.prepare()
await app.run()
Now all authentication actions are available to access on path authentication/<action>
Options
initialize
takes the same options as Authentication
.
Additionally takes the following ones:
rootPath
String
default: /authentication
You can set the root of all authentication routes, ex:/auth/<action>
Authentication Modules
Enabled authentication modules that provide a controllers will be enabled in express controllers if they are enabled in the authentication api. For example the default module provided by universal-authentication
is enabled by default.
Typescript
This library is developed in TypeScript and shipped fully typed.
Contributing
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.