1.0.24 • Published 6 months ago

shiv-backend-setup v1.0.24

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

Express.js Project Setup Script

šŸš€ Overview

This script automates the setup of an Express.js project with essential dependencies and folder structure. It simplifies project initialization, installs necessary packages, and ensures a clean environment.

šŸ“ Project Structure

After running the script, your project will have the following structure:

project-name/
│-- src/
│   │-- config/
│   │   ā”œā”€ā”€ db.js
│   │-- controllers/
│   │   ā”œā”€ā”€ authController.js
│   │-- middlewares/
│   │-- models/
│   │-- routes/
│   │   ā”œā”€ā”€ authRoutes.js
│   │-- utils/
│   ā”œā”€ā”€ app.js
│   ā”œā”€ā”€ server.js
│-- .gitignore
│-- .env
│-- package.json

šŸ› ļø Features

  • Automatically creates necessary folders (src/config, src/controllers, etc.).
  • Generates essential files (server.js, app.js, .env, db.js).
  • Initializes package.json (if not present) and sets up scripts.
  • Installs required dependencies.
  • Adds .gitignore to exclude node_modules and .env.

šŸ“Œ Prerequisites

  • Node.js (Latest LTS recommended)
  • npm installed

⚔ Installation & Usage

Step 1: Run the setup script

npx create-express-app@latest project-name

Replace project-name with your desired project folder name.

Step 2: Navigate into the project folder

cd project-name

Step 3: Start the server

  • Run with Node.js:
    npm start
  • Run with Nodemon (for development):
    npm run dev

šŸ“¦ Installed Dependencies

PackagePurpose
expressBackend framework
dotenvEnvironment variable management
mongooseMongoDB ODM
jsonwebtokenAuthentication (JWT)
bcryptPassword hashing
cookie-parserCookie handling
corsCross-Origin Resource Sharing
nodemonAuto-restart for development

šŸ“ Environment Variables (.env)

PORT=4000
MONGO_URI=mongodb://localhost:27017/
JWT_SECRET=your_jwt_secret

šŸ¤– API Routes

Auth Routes (/api/auth)

MethodRouteDescription
POST/registerUser registration
POST/loginUser login

šŸ› ļø Contributing

  1. Fork the repository.
  2. Clone the forked repository.
  3. Create a new branch (git checkout -b feature-branch).
  4. Commit your changes (git commit -m "Added new feature").
  5. Push to the branch (git push origin feature-branch).
  6. Open a Pull Request.

šŸ“œ License

This project is licensed under the MIT License.


šŸŽ‰ Happy Coding! šŸš€

git add .
git commit -m "message"
npm version patch
npm publish --access public
1.0.24

6 months ago

1.0.23

6 months ago

1.0.22

6 months ago

1.0.21

6 months ago

1.0.20

6 months ago

1.0.19

6 months ago

1.0.18

6 months ago

1.0.17

6 months ago

1.0.16

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago