UNPKG

@bodheesh/create-bodhi-node-app

Version:

Create a production-ready Node.js REST API with zero configuration

69 lines (52 loc) 1.4 kB
# REST API Boilerplate A simple and scalable REST API boilerplate built with Node.js, Express, and MongoDB. ## Features - Express.js framework - MongoDB with Mongoose ODM - Basic authentication setup - User CRUD operations - Error handling middleware - Environment variables configuration - Basic security with helmet ## Getting Started ### Prerequisites - Node.js (v14 or higher) - MongoDB ### Installation 1. Clone the repository 2. Install dependencies: ```bash npm install ``` 3. Create a `.env` file in the root directory and add your environment variables: ```env NODE_ENV=development PORT=3000 MONGODB_URI=mongodb://localhost:27017/your-database JWT_SECRET=your-jwt-secret JWT_EXPIRES_IN=1d ``` 4. Start the server: ```bash npm start ``` ## API Endpoints ### Users - GET /api/users - Get all users - GET /api/users/:id - Get a single user - POST /api/users - Create a new user - PUT /api/users/:id - Update a user - DELETE /api/users/:id - Delete a user ## Project Structure ``` src/ ├── config/ # Configuration files ├── controllers/ # Route controllers ├── middleware/ # Custom middleware ├── models/ # Mongoose models ├── routes/ # Route definitions ├── app.js # Express app setup └── index.js # App entry point ``` ## Contributing Feel free to submit issues and enhancement requests.