ECOMCROW
MULTI VENDOR ECOMMERCE API
Instructions on how to set up the project locally.
-
Clone the repository:
git clone https://github.com/demamano/EcomCrow.git
-
Navigate to the project directory:
cd project-name -
Install dependencies:
npm install
Basic usage instructions.
npm startConfiguration details for the project.
Create a .env file in the root directory and add the following variables:
PORT=3000
MONGO_URI=mongodb://localhost:27017/database_name
Details on how to set up the MongoDB connection.
This project uses Mongoose to interact with MongoDB. The connection setup can be found in src/database.js:
const mongoose = require('mongoose');
const connectDB = async () => {
try {
const conn = await mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
console.log(`MongoDB Connected: ${conn.connection.host}`);
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
}
};
module.exports = connectDB;Ensure the connection is established when the server starts. Modify src/server.js:
const express = require('express');
const connectDB = require('./database');
const app = express();
// Connect to MongoDB
connectDB();
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});Scripts provided in package.json to help with development and deployment.
-
Start the application:
npm start
-
Run tests:
npm test
Guidelines for contributing to the project.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
Specify the project's license.
This project is licensed under the MIT License - see the LICENSE file for details.