Skip to content
LeChatErrant edited this page Apr 9, 2021 · 16 revisions

CLI

The template comes with a Command-Line Interface that helps you to initialize, develop and maintain your projects.

It essentially saves your time by writing boilerplate code for you

Installation

The CLI is listed in the dev-dependencies of the template, so all you need to do is

  1. npm install
  2. npm run cli

If you want to, you can install the cli globally with npm install -g templated-project-cli to be able to launch it with from anywhere

Create new resource

Each time you need to add a new resource to your API, you need to write some boilerplate code (router, middlewares, controllers, tests, and more...)

The CLI save your time by writing this code for you

  1. npm run cli
  2. Choose generate new API resource
  3. Enter the name of the resource to be created (singular form)
  4. The CLI will infer the plural form. In case it is not correct, you can still write it by hand
  5. Relax and take a coffee

What is generated ?

  • Default model in schema.prisma

CLI - Generate

Clone this wiki locally