Reuse SOMOD Module


SOMOD framework is designed by keeping reusability at its core.

Add the required modules as npm dependencies to the current module. The SOMOD CLI will take care of discovering and wiring all the installed modules to prepare the AWS SAM project and the NextJs project.

Example:-

The User Management module that we have created in our Getting Started / Develop chapter is available as the somod-example-user-management. Let us reuse somod-example-user-management in a new module.

  • Initialize an empty SOMOD module

    npx create-somod --no-files somod-reuse-example cd somod-reuse-example
  • Install somod-example-user-management as a dependency

    npm i somod-example-user-management
  • Configure the module

    create parameters.json file with the below contents

    { "apigateway.http.cors.allow_headers": [ "authorization", "content-type", "content-length" ], "apigateway.http.cors.allow_methods": ["GET", "POST", "PUT", "DELETE"], "apigateway.http.cors.allow_origins": ["http://localhost:3000"] }
  • Deploy the current module
    SOMOD automatically prepares AWS SAM Project for deployment

    npx somod deploy -v --guided
  • Get the new Endpoint URL Run the following command to retrieve the endpoint URL for the newly deployed module

    npx somod update-params
  • Start a NextJS server Run the following command to start the UI server.

    npx somod start

In the above example, we have created a web application without actually writing the code.
In the Next Chapter, let us understand how to deploy the SOMOD modules.

Does this page need improvements?
Edit This Page in GitHub
Did this page help you?
Provide feedback in the GitHub Discussion Page
Need More help?

Write an email to opensource@sodaru.com

This documentation is built using
Developed and Maintained By
Sodaru Technologies
https://sodaru.com
© 2023