Creation of your modules

Prerequisites

To work on Marjory's modules, you will need:

  • Node v13+ - We recommend you have the latest LTS version installed.

  • An IDE - We recommend VS Code

  • A terminal - You can use VS Code integrated terminal

  • A clear understanding of Marjory workflow - Learn more on the page Introduction

Create a draft

When you go to the My Modules app, you'll find a button to create a new module. The first thing you need to do is to give your module a name, then choose if you want to generate the module from a swagger or from scratch.

Using a Swagger

If you have a Swagger or OpenAPI file (.json or .yaml), you can upload it directly when creating the draft to autogenerate actions based on API request. This will save you time but won't do everything for you.

From scratch

You can also start from scratch with our ready to use boilerplate containing everything needed to start developing a module.

Test it out

After downloading your generated module or boilerplate, open your module in your IDE. Make sure the marjory and marjory-cli package is set in dependencies, the type is set to module and you have the scripts set up.

package.json
{
  ...
  "type": "module"
  "scripts": {
    "local": "marjory local",
    "action": "marjory action",
    "package": "marjory package"
  },
  "dependencies": {
    "marjory": "1",
    "marjory-cli": "1",
  },
  ...
}

Now that everything is set up, you can open a terminal in your module folder and run:

yarn install
yarn local

You have now an offline server running at http://localhost:3000.To learn more on how to test your module, go to Test your module. Be aware that the test server does not watch for files changes, you have to relaunch the server to test your modifications.

Last updated