sam-app-starter

1.0.3 • Public • Published

sam-starter

sam-starter is a CLI tool for initializing backend development projects with a structured setup for models, controllers, routes, and more.

Installation

To install sam-starter, use npm (Node.js package manager):

npm install -g sam-starter

This command installs sam-starter globally, allowing you to use it from any directory in your terminal.

Usage

Initializing the Starter Kit

To initialize a new backend project using sam-starter, navigate to your project directory and run:

sam init

This command sets up the basic project structure and installs necessary dependencies defined in the starter template.

Creating Models

To create a new model in your project, use the following command:

sam make:model ModelName

Replace ModelName with the name of your model. This command creates a new model file (ModelNameModel.js) under src/models and sets up basic schema and model definitions using Mongoose.

Creating Controllers

To create a new controller in your project, use the following command:

sam make:controller ControllerName

Replace ControllerName with the name of your controller. This command generates a new controller file (ControllerNameController.js) under src/controllers with a basic controller class template.

Creating Routes

To create a new route in your project, use the following command:

sam make:route RouteName

Replace RouteName with the name of your route. This command creates a new route file (RouteNameRoute.js) under src/routes and sets up route handlers using Express.

Note: If a route file with the specified name already exists, sam-starter will display a message indicating that the route already exists and will not overwrite the existing file.

Project Structure

After initializing your project with sam init, the project structure will look like this:

my-project/
│
├── src/
│   ├── models/
│   │   ├── ModelNameModel.js
│   │   └── ...
│   ├── controllers/
│   │   ├── ControllerNameController.js
│   │   └── ...
│   ├── routes/
│   │   ├── RouteNameRoute.js
│   │   └── route.js
│   │   └── ...
│   └── ...
│
├── package.json
└── README.md

License

This project is licensed under the MIT License - see the LICENSE file for details.


Readme

Keywords

none

Package Sidebar

Install

npm i sam-app-starter

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

17.9 kB

Total Files

20

Last publish

Collaborators

  • donsimeone2206