1.0.3 β€’ Published 8 months ago

express-starter-script v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

πŸš€ EXPRESS STARTER SCRIPT

GitHub LinkedIn

This script is used to quickly set up a Node.js project with Express and MongoDB. It will create a new project directory, initialize the project with npm, install necessary dependencies, and set up basic files and structure for an Express app that connects to MongoDB.

πŸ“‘ Table of Contents

βœ… How to Use:

  1. Run the script using the following command:

    npx express-starter-script [Project name]

    or

    npx git@github.com:omraannn/Express-starter-script.git [Project name]

    or

    npx https://www.npmjs.com/package/express-starter-script [Project name]

    πŸ“ Note: (If no project name is provided, it will default to my-express-project.)

πŸ’‘ What This Script Does:

  • Creates a new project directory with the specified name.
  • Initializes a new Node.js project using npm init.
  • Installs required dependencies:
    • Express, MongoDB, dotenv, CORS, body-parser, mongoose.
  • Adds nodemon as a development dependency for hot-reloading.
  • Sets up folders for core components:
    • config/ - Configuration files
    • controllers/ - Controllers for request handling
    • models/ - Mongoose models
    • routes/ - Route definitions
  • Generates configuration files:
    • .env for environment variables
    • db.js - MongoDB connection configuration
    • UserModel.js - Mongoose model for User
    • userController.js - Basic user controller
    • userRoute.js - Routes for the user
    • server.js - Main entry point for the app
  • Adds start and dev scripts to package.json for running with nodemon.

πŸ”§ Requirements:

  • Make sure you have Node.js and npm installed on your system.
  • MongoDB should be set up and running, or you can use a cloud service like MongoDB Atlas.
  • You need to create your database first (the script will connect using the project name as the database name, but you can change this later).

πŸ“‚ Folder Structure:

The script will generate the following structure:

my-express-project/
β”œβ”€β”€ config/
β”‚   └── db.js
β”œβ”€β”€ controllers/
β”‚   └── userController.js
β”œβ”€β”€ models/
β”‚   └── UserModel.js
β”œβ”€β”€ routes/
β”‚   └── userRoute.js
β”œβ”€β”€ .env
β”œβ”€β”€ server.js
β”œβ”€β”€ package.json
└── node_modules/

πŸ› οΈ Customization:

  • You can modify the generated files (such as UserModel.js, userController.js, and userRoute.js) to fit your application’s needs.
  • Update the .env file with your MongoDB connection string (MONGODB_URI).
  • You can add additional routes, controllers, and models as required.

🀝 Contribute:

If you’d like to contribute to this project, please fork the repository and submit a pull request. Your contributions, whether bug fixes, enhancements, or documentation updates, are always welcome!

  1. Fork the Project.
  2. Create your Feature Branch: git checkout -b feature/YourFeature.
  3. Commit your Changes: git commit -m 'Add some feature'.
  4. Push to the Branch: git push origin feature/YourFeature.
  5. Open a Pull Request.

πŸ§‘β€πŸ’» Author:

This script was created with ❀ by DEKHIL_Omran.


πŸ“œ License:

This project is available under the MIT License.

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago