Skip to content

Commit

Permalink
add ref project
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Nov 26, 2023
1 parent a613d5f commit 6aa7339
Show file tree
Hide file tree
Showing 171 changed files with 18,417 additions and 0 deletions.
41 changes: 41 additions & 0 deletions ref_project/ecommerce/ecommerce-backend-master/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
!**/src/main/resources/application.properties

/src/main/resources/application.properties

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache


### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Log Files ###
nohup.out

12 changes: 12 additions & 0 deletions ref_project/ecommerce/ecommerce-backend-master/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Start with a base image - in this case JDK 8 Alpine
FROM openjdk:8-jdk-alpine
# Run as a non-root user to mitigate security risks
# https://security.stackexchange.com/questions/106860/can-a-root-user-inside-a-docker-lxc-break-the-security-of-the-whole-system
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
# Specify JAR location
ARG JAR_FILE=target/*.jar
# Copy the JAR
COPY ${JAR_FILE} app.jar
# Set ENTRYPOINT in exec form to run the container as an executable
ENTRYPOINT ["java","-jar","/app.jar"]
56 changes: 56 additions & 0 deletions ref_project/ecommerce/ecommerce-backend-master/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ecommerce
Ecommerce backend apis

Backend
https://github.com/webtutsplus/ecommerce-backend

https://limitless-lake-55070.herokuapp.com/swagger-ui.html

Frontend

https://github.com/webtutsplus/ecommerce-vuejs

https://infallible-swartz-b50174.netlify.app/



* This is a Maven Project. Ensure, Maven is installed on your system.
* It is Recommended that you use Linux Based OS.
* It might happen that you have installed XAMPP/LAMPP software (by Bitnami) on your system. Instead of using the db provided by XAMPP/LAMPP by bitnami, it is recommended that you install ``mariadb-server`` and use it as database while running this application.

###How to run in local
1. Rename ``src/main/resources/application.properties.example`` to ``src/main/resources/application.properties``.
1. Change the Application Properties (E.g. username/password of DB) present in ``resources/application.properties`` according to your local mysql-server.
1. Go to application.properties and comment / uncomment the corresponding front-end url and enter the STRIPE API Keys
1. Create a database called `ecommerce` with ``CHARACTER SET utf8mb4`` and `COLLATE utf8mb4_0900_ai_ci`. MariaDB does not support `COLLATE utf8mb4_0900_ai_ci`. So, if you are using MariaDB, open `database-dump.sql` file and replace `COLLATE utf8mb4_0900_ai_ci` with `COLLATE utf8mb4_general_ci`
1. Import `database-dump.sql` in it.
1. To run the application, run the command ``sh run.sh`` i.e. execute the ``run.sh`` file.
1. After starting application, go to http://localhost:8080/api/swagger-ui.html/

## Category/Update/{id}
* The input for updating the category via API is
```
{
"categoryName":"name",
"imageUrl":"url",
"description":"desc"
}
```


### In case of "java.lang.IllegalStateException: Unable to load cache item error":
- Go into pom.xml and comment out the scope for the "spring-boot-starter-tomcat" dependency


## How to use prod profile
mvn package
java -jar -Dspring.profiles.active=prod <package name in target>

## Run in production server with latest changes in master


#admin access
email: [email protected]
password: admin
firstname: admin

20 changes: 20 additions & 0 deletions ref_project/ecommerce/ecommerce-backend-master/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 0.2
phases:
install:
runtime-versions:
java: corretto8
pre_build:
commands:
- echo In the pre_build phase...
build:
commands:
- echo Build started on `date`
post_build:
commands:
- echo Build completed on `date`
- mvn package
- mv target/bike-service-0.0.1-SNAPSHOT.war bike-service-1.0.2-SNAPSHOT.war
artifacts:
files:
- bike-service-1.0.2-SNAPSHOT.war
- .ebextensions/**/*
252 changes: 252 additions & 0 deletions ref_project/ecommerce/ecommerce-backend-master/database-dump.sql

Large diffs are not rendered by default.

Empty file.
126 changes: 126 additions & 0 deletions ref_project/ecommerce/ecommerce-backend-master/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>

<version>2.4.0</version>

</parent>
<groupId>com.survey</groupId>
<artifactId>ecommerce-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- <packaging>war</packaging> -->
<packaging>jar</packaging>
<name>ecommerce-backend</name>
<description>ecommerce</description>

<properties>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>20.41.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>

<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency> -->


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.9.8</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>2.9.2</version>
</dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency> -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 6aa7339

Please sign in to comment.