@mhmdzaien/nuxt-sequelize v1.0.18
Nuxt Sequelize
Nuxt module to integrate sequelize and model at server api
Features
- Integrate with sequelize model
- Add controller support on server handler
- Authentication using token header
Quick Setup
1.Install the module to your Nuxt application with one command:
npx nuxi@latest module add @mhmdzaien/nuxt-sequelize2.Add @mhmdzaien/nuxt-sequelize, models path and nitro support decorator in nuxt.config.ts
export default defineNuxtConfig({
modules: [@mhmdzaien/nuxt-sequelize],
nitro: {
esbuild: {
options: {
tsconfigRaw: {
compilerOptions: {
experimentalDecorators: true,
},
},
},
},
},
nuxtSequelize: {
modelPath: './server/models',
},
})3.Create index.js inside 'modelPath' that contain loader to model
export function initModels(sequelize: Sequelize) {
User.initModel(sequelize)
}4.Create .env file contain database configuration
DB_NAME=
DB_USER=root
DB_PASSWORD=
DB_HOST=localhost
DB_DRIVER=DB_DRIVER is one of sequelize supported dialect
That's it! You can now use My Module in your Nuxt app ✨
Server utils
defineMyEventHandler(handler, authorizeRequest?)
- handler : Function(event) => callback handler with event parameter
- authorizeRequest : "*" | Array => if set handler check authentication in token header accepted role number
Contribution
5 months ago
9 months ago
5 months ago
9 months ago
9 months ago
12 months ago
11 months ago
11 months ago
11 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago