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
}
}
endpoint
Default:process.env.BADASO_URL || 'http://localhost:8000'
URL of the Badaso server. Environtment variable BADASO_URL can be used to overrideendpoint
.entities
Default:{}
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
:Boolean
content
:Boolean
crud
:Array
key
Key used for the cookie name as well as localStorage/sessionStorage key.prefix
Default:badaso-api
URL 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.user
For content module, please refer to this page
For CRUD generated, please refer to this page
- Clone this repo
- Install dependencies using
npm install
oryarn install
- Start development server using
npm run dev
oryarn dev