Skip to content

Commit 85f8cdb

Browse files
committed
Update Changes & Bug Fixes
1 parent 10af3e8 commit 85f8cdb

File tree

3 files changed

+43
-34
lines changed

3 files changed

+43
-34
lines changed

.env.example

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
PORT=YOUR_PORT
2+
3+
MONGO_URI=YOUR_MONGODB_URL
4+
DB_NAME=YOUR_DATABASE_NAME
5+
6+
NODE_ENV=dev
7+
SERVER_MAINTENANCE='false'
8+
9+
JWT_SECRET=YOUR_SECRET
10+
JWT_EXPIRES_IN=30d # CUSTOMIZE AS PER YOUR CHOICE
11+
12+
COOKIE_EXPIRES_IN=15 # CUSTOMIZE AS PER YOUR CHOICE
13+
14+
SMTP_FROM='Example <noreply@example.com>' # CUSTOMIZE AS PER YOUR CHOICE
15+
SENDGRID_API_KEY=YOUR_SENDGRID_API_KEY
16+
17+
# Cloudinary
18+
CLOUDINARY_CLOUD_NAME=YOUR_CLOUDINARY_CLOUD_NAME
19+
CLOUDINARY_API_KEY=YOUR_CLOUDINARY_API_KEY
20+
CLOUDINARY_API_SECRET=YOUR_CLOUDINARY_API_SECRET
21+
22+
# STRIPE CONFIG
23+
STRIPE_API_KEY=YOUR_STRIPE_API_KEY
24+
STRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY
25+
26+
# GitHub
27+
GITHUB_TOKEN=YOUR_GITHUB_TOKEN
28+
GITHUB_USERNAME=YOUR_GITHUB_USERNAME

README.md

+11-28
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ This repository contains the source code for a E-commerce API built using Node.j
3232

3333
## Features
3434

35-
- User authentication and authorization.
36-
- CRUD operations for users, jobs, and applications.
37-
- JWT-based authentication for secure API access.
38-
- RESTful API design.
39-
- Written in TypeScript for enhanced maintainability and type safety.
35+
- **User Authentication:** Register, login, and manage user accounts with JWT-based authentication.
36+
- **Product Management:** CRUD operations for products.
37+
- **Shopping Cart:** Add, update, and remove items in the shopping cart.
38+
- **Order Management:** Place orders and view order history.
39+
- **Stripe Payment Gateway:** Integrate Stripe for secure payment processing.
40+
- **MongoDB Integration:** Store and manage data using MongoDB.
4041

4142
## Getting Started
4243

@@ -48,6 +49,7 @@ You need to have the following software installed on your computer:
4849

4950
- [Node.js](https://nodejs.org/) (LTS version recommended)
5051
- [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/) or [Yarn](https://yarnpkg.com/) package manager
52+
- Stripe account and API keys
5153

5254
### Installation
5355

@@ -62,7 +64,7 @@ You need to have the following software installed on your computer:
6264
3. Navigate to the project directory:
6365

6466
```bash
65-
cd portfolio-nextjs
67+
cd ecommerce-api-nodejs
6668
```
6769

6870
4. Install the project dependencies:
@@ -113,33 +115,14 @@ By default, the application will run on port `3000`. You can change the port by
113115

114116
## Deployment
115117

116-
This API can be deployed using various platforms such as Heroku, AWS, Google Cloud Platform, or your own server infrastructure. Here are some general steps to deploy the API:
117-
118-
1. **Prepare your environment**: Ensure that your deployment environment meets the requirements specified in the Prerequisites section.
119-
120-
2. **Build the application**: If necessary, build the TypeScript code into JavaScript. You can do this by running:
121-
122-
```bash
123-
npm run build
124-
#or
125-
yarn build
126-
```
127-
128-
3. **Configure environment variables**: Set up environment variables similar to how it's done in the local setup. Ensure that you provide appropriate values for your deployment environment.
129-
130-
4. **Deploy the application**: Deploy the built application to your chosen platform. Each platform may have its own deployment process. Refer to the documentation of your chosen platform for detailed instructions.
131-
132-
5. **Start the application**: Once deployed, start the application in your deployment environment. This might involve running a command similar to `npm start` or `yarn start`, depending on your setup.
133-
134-
6. **Monitor the deployment**: Monitor the deployed application for any issues. Make sure that it's running smoothly and handle any errors or performance issues as needed.
118+
This API can be deployed using various platforms such as Vercel, Heroku, AWS, Google Cloud Platform, or your own server infrastructure. Set up environment variables similar to how it's done in the local setup. Ensure that you provide appropriate values for your deployment environment. Deploy the built application to your chosen platform. Each platform may have its own deployment process. Refer to the documentation of your chosen platform for detailed instructions. Monitor the deployed application for any issues. Make sure that it's running smoothly and handle any errors or performance issues as needed.
135119

136120
## Technologies Used
137121

138122
- Node.js
139123
- Express.js
140124
- JavaScript
141-
- MongoDB (or any other database of your choice)
142-
- Stripe
125+
- MongoDB
143126

144127
## Contributing
145128

@@ -175,6 +158,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
175158
[gmail]: mailto:nkr.nikhil.nkr@gmail.com
176159

177160
[repo]: https://github.com/nixrajput/ecommerce-api-nodejs
178-
[issues]: https://github.com/nixrajput/ecommerce-api-nodejs
161+
[issues]: https://github.com/nixrajput/ecommerce-api-nodejs/issues
179162
[pulls]: https://github.com/nixrajput/ecommerce-api-nodejs/pulls
180163
[license]: https://github.com/nixrajput/ecommerce-api-nodejs/blob/master/LICENSE.md

src/server.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ const app = runApp();
88
// Config
99
if (process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "prod") {
1010
require("dotenv").config({
11-
path: "./config.env",
11+
path: "./.env.local",
1212
});
13+
14+
console.log("[.env]: env values loaded");
1315
}
1416

1517
// Cloudinary Setup
@@ -62,7 +64,6 @@ const connectToDatabase = function () {
6264
console.log(`[server] running on port: ${port}`);
6365
});
6466

65-
6667
setTimeout(() => {
6768
server.close();
6869
connectToDatabase();
@@ -144,9 +145,7 @@ const connectToDatabase = function () {
144145

145146
app.listen(port, (err) => {
146147
if (err) {
147-
console.log(
148-
`[server] could not start http server on port: ${port}`
149-
);
148+
console.log(`[server] could not start http server on port: ${port}`);
150149
return;
151150
}
152151
console.log(`[server] running on port: ${port}`);
@@ -155,4 +154,3 @@ const connectToDatabase = function () {
155154
connectToDatabase();
156155
}
157156
})();
158-

0 commit comments

Comments
 (0)