1.0.24 ⢠Published 6 months ago
shiv-backend-setup v1.0.24
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 excludenode_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
Package | Purpose |
---|---|
express | Backend framework |
dotenv | Environment variable management |
mongoose | MongoDB ODM |
jsonwebtoken | Authentication (JWT) |
bcrypt | Password hashing |
cookie-parser | Cookie handling |
cors | Cross-Origin Resource Sharing |
nodemon | Auto-restart for development |
š Environment Variables (.env)
PORT=4000
MONGO_URI=mongodb://localhost:27017/
JWT_SECRET=your_jwt_secret
š¤ API Routes
Auth Routes (/api/auth
)
Method | Route | Description |
---|---|---|
POST | /register | User registration |
POST | /login | User login |
š ļø Contributing
- Fork the repository.
- Clone the forked repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m "Added new feature"
). - Push to the branch (
git push origin feature-branch
). - 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