Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/
.idea/**
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
.idea/*
*.iml

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
target/*

.project
.classpath
.settings

*.mvn
.DS_STORE
100 changes: 55 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,78 @@

* **Objective** - to create an implementation of a web service
* **Purpose** - to demonstrate the construction of a full-stacked web-application
* **Description**
* This Case Study is your first foray into building a full-stack application. You'll be building a Spring MVC based application, which means you'll learn about what it takes to build a functional application from the ground up yourself.
* This is exciting! It's a lot, but we've given you the tools to be able to build what you need, and you get to decide what you do with it. You also get to be creative in choosing what sort of application you want to build!
* You will be working individually to design your app. We hope you'll exercise creativity on this project, sketch some wireframes before you start, make sure you have time to run these ideas by your instructors to get their feedback before you dive too deep into coding! Remember to keep things small and focus on mastering the fundamentals.
* **Additional Resources**
* [The Original Case Study Document](./case-study.pdf)
* [Case Study Outline](./case-study-outline.pdf)
* [Case Study Deliverables](./README_deliverables.md)
* [Identifying Plagiarism](./README_plagiarism.md)
* [Suggested Project Topics](./README_suggested-project-topics.md)



## Minimum Features
* `RESTful` web service which consumes requests from a front-end web application and caches each request and the respective response to a database.
* The application must support a login functionality.



* **Description**
The Project is an E-commerce website that uses to sell the products. The admin can add, delete, or change products from the website. the customers can filter by the low price, high price, newest listed, range of the price. The customers can add the products to the card before they bought them, or they can delete them from the cart. If they want to update the cart. After they process their purchase, the website displays the details of the purchase.

* **Trello Link**
https://trello.com/b/PUWfFL6E/casestudy

## Developmental Notes

### Tech Stack Selection
* Select at least 1 technology from each of the following categories:
* **Version Control System**
1. Github
2. Bitbucket
Github

* **Wireframe**
1. Mockflow
2. Balsamiq
3. Lucidcharts

Balsamiq

* **Frontend**
1. Java Server Pages
Angular Cascading Style Sheets(CSS) HTML

* **Business Logic**
1. Java
2. TypeScript

Java

* **WebServer Implementation**
1. Spring Boot
2. At least 1 [backing service](https://12factor.net/backing-services) API

Spring Boot

* **Data Layer**
1. MySQL
2. PostgreSQL
3. MariaDB
MariaDB

* **Web Server Cloud Deployment**
1. Heroku
2. AWS EC2 Instance
AWS EC2 Instance

* **Web Application Cloud Deployment**
1. Netlify
2. AWS EC2 Instance




### Installation
* It is advised that you make install each of the following technologies to ensure that are at least accessible
* Install [NodeJs](https://nodejs.org/en/).
* Install [Angular](http://angular.io/).
* Install [AngularCli](https://cli.angular.io/).
### Pre Requisite Software
* Java8 Runtime Environment
* AngularJS Cli
* MariaDB

### How to run Application
* run `generateTables.sql` in db scripts folder
* run [`pom.xml`](./backend/case-study-ecommerce/pom.xml) file
* update username and password of application.properties
`spring.datasource.username=your_mariaDB_username
spring.datasource.password=your_mariaDB_password`

* Open command line and run this command:
`mvn spring-boot:run`
* From the root directory execute the following command:
* `npm install`
* `ng serve --open`
* Upon running, the application should be visible by navigating to * `http://localhost:4200`

### Troubleshooting
* If your application cannot run because something is occupying a port, use this command with the respective port number specified:
* **OSX and Linux**
* ``kill -kill `lsof -t -i tcp:8080` ``
* ``kill -kill `lsof -t -i tcp:4200` ``
* **Windows**
* _For use in command line_:
* `for /f "tokens=5" %a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %a`
* `for /f "tokens=5" %a in ('netstat -aon ^| find ":4200" ^| find "LISTENING"') do taskkill /f /pid %a`
* _For use in bat-file_:
* `for /f "tokens=5" %%a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %%a`
* `for /f "tokens=5" %%a in ('netstat -aon ^| find ":4200" ^| find "LISTENING"') do taskkill /f /pid %%a`

#### Cloning _forked_ repository
* Clone the repository from **your account** into the `~/dev` directory.
* if you do not have a `~/dev` directory, make one by executing the following command:
* `mkdir ~/dev`
* navigate to the `~/dev` directory by executing the following command:
* `cd ~/dev`
* clone the project by executing the following command:
* `git clone https://github.com/${MYUSERNAME}/${NAMEOFPROJECT}`
33 changes: 33 additions & 0 deletions backend/case-study-ecommerce/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### 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/
117 changes: 117 additions & 0 deletions backend/case-study-ecommerce/.mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
1 change: 1 addition & 0 deletions backend/case-study-ecommerce/kill-port.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for /f "tokens=5" %%a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %%a
1 change: 1 addition & 0 deletions backend/case-study-ecommerce/kill-port.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kill -kill `lsof -t -i tcp:8080`
Loading