Nuxt module for integration with badaso out of the box.
- RESTful methods
- Handle errors with hooks
Using npm:
npm install @badaso/nuxt
Using yarn:
yarn add @badaso/nuxt
Add @badaso/nuxt to the modules section of nuxt.config.js:
export default {
modules: ['@badaso/nuxt'],
badaso: {
// Options
}
}endpointDefault:process.env.BADASO_URL || 'http://localhost:8000'URL of the Badaso server. Environtment variable BADASO_URL can be used to overrideendpoint.entitiesDefault:{}You can specify the entities that present in your API. For example:Then you can useexport default { badaso: { entities: { post: true, crud: ['articles', 'products'] } } }
this.$badaso.$post.browse()in your application. For now, entities only accept:post:Booleancontent:Booleancrud:Array
keyKey used for the cookie name as well as localStorage/sessionStorage key.prefixDefault:badaso-apiURL prefix to access Badaso API server.
To handle authentication in your Nuxt app with Badaso, you can:
await this.$badaso.login({ email: '', password: '' })await this.$badaso.register({ email: '', name: '', password: '', passwordConfirmation: '' })await this.$badaso.verify({ email: '', token: '' })await this.$badaso.sendEmailConfirmation({ email: '' })await this.$badaso.logout()await this.$badaso.forgotPassword({ email: '' })await this.$badaso.verifyForgotPasswordToken({ email: '', token: '' })await this.$badaso.resetPassword({ email: '', password: '', token: '' })Once logged in, you can access your user everywhere:
this.$badaso.userFor content module, please refer to this page
For CRUD generated, please refer to this page
- Clone this repo
- Install dependencies using
npm installoryarn install - Start development server using
npm run devoryarn dev