Create a REST API route based on the database

One page summary of how to create a REST API route based on the database in a Skulljs project.

Requirements

  • Working project — check that your project works locally
  • ORM’s schema file - ensure the descriptions of the database tables are correct
  • Node.js — latest LTS version or newer
  • Skulljs-cli — the version you used to create the project or a newer version
Why ORM's schema file? Skulljs parse the ORM’s schema file to retrieve database description and generate the REST API route based on the database model that you selected.

Create a REST API route based on the database

Use the Skulljs CLI to generate files.

Use sk route:create

sk route:create
  1. Enter the path of the route
  2. Select a database model
  3. Select which CRUD’s parts you want to generate
  4. Tell the CLI if you want the frontend service files to be generated aswell

That’s all ! Your files are now generated and ready to be used.