moralis-plugins
TypeScript icon, indicating that this package has built-in type declarations

1.1.26 • Public • Published

logo

Moralis Plugins

Code generation for Moralis Plugins

npm install moralis-plugins --global

Create Plugin

moralis-plugins create greetings
cd greetings

Develop Plugin

greetings/src/index.ts

import Moralis from 'moralis-plugins'

const plugin = new Moralis.Plugin({
  name: 'Greetings',
  description: 'Example greeting plugin',
  version: '1.0.0',
})

plugin.define<{ name: string }>(
  'hello/:name',
  req => {
    const a = `Hello, ${req.params.name}`
    return a
  },
  {
    description: 'Returns a hello greeting',
    returnDescription: 'A hello greeting',
  }
)

export default plugin

Build Plugin

moralis-plugins build

Should receive output as follows

Plugin saved to dist
Swagger saved to swagger.yml
Client saved to client

Run Plugin Locally

moralis-plugins serve

Should receive output as follows

Plugin saved to dist
OpenApi Docs at http://localhost:8080/api-docs

Result

/moralis-plugins/

    Package Sidebar

    Install

    npm i moralis-plugins

    Weekly Downloads

    0

    Version

    1.1.26

    License

    ISC

    Unpacked Size

    521 kB

    Total Files

    60

    Last publish

    Collaborators

    • locothedev
    • ernow
    • cicdmoralis
    • y0moo
    • capplequoppe
    • gerardo15
    • ivanontech
    • rphansen91