1.0.18 • Published 6 months ago

@mhmdzaien/nuxt-sequelize v1.0.18

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Nuxt Sequelize

npm version npm downloads License Nuxt

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-sequelize

2.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

1.0.18

6 months ago

1.0.1

10 months ago

1.0.17

6 months ago

1.0.0

11 months ago

1.0.16

10 months ago

1.0.9

1 year ago

1.0.0-alpha.4

1 year ago

1.0.0-alpha.3

1 year ago

1.0.0-alpha.2

1 year ago

1.0.0-beta.2

10 months ago

1.0.0-beta.3

10 months ago

1.0.0-beta.4

10 months ago

1.0.0-beta.5

10 months ago

1.0.0-beta.1

11 months ago

1.0.0-beta.6

10 months ago

1.0.0-beta.7

10 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago