Skip to content

Commit

Permalink
Updated README.md and added script for running appliacation using htt…
Browse files Browse the repository at this point in the history
…p-server
  • Loading branch information
ikismail committed Apr 30, 2018
1 parent fe337f5 commit 8d092f9
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 134 deletions.
47 changes: 35 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Angular5 - ShoppingCart

[![HitCount](http://hits.dwyl.io/ikismail/Angular-ShoppingCart.svg)](http://hits.dwyl.io/ikismail/Angular-ShoppingCart)
[![HitCount](http://hits.dwyl.io/ikismail/Angular4-ShoppingCart.svg)](http://hits.dwyl.io/ikismail/Angular4-ShoppingCart)

[![Build Status](https://travis-ci.org/ikismail/Angular-ShoppingCart.svg?branch=master)](https://travis-ci.org/ikismail/Angular-ShoppingCart)
[![Build Status](https://travis-ci.org/ikismail/Angular5-ShoppingCart.svg?branch=master)](https://travis-ci.org/ikismail/Angular5-ShoppingCart)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/ikismail/Angular-ShoppingCart/blob/master/LICENSE)
[![GitHub issues](https://img.shields.io/github/issues/ikismail/Angular-ShoppingCart.svg)](https://github.com/ikismail/Angular-ShoppingCart/issues)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bfc80f32f4e34a909804289263a747f5)](https://www.codacy.com/app/ikismail/Angular4-ShoppingCart?utm_source=github.com&utm_medium=referral&utm_content=ikismail/Angular4-ShoppingCart&utm_campaign=Badge_Grade)

[![dependency Status](https://david-dm.org/ikismail/Angular-ShoppingCart.svg)](https://david-dm.org/ikismail/Angular-ShoppingCart#info=dependencies)
[![devDependency Status](https://david-dm.org/ikismail/Angular-ShoppingCart/dev-status.svg)](https://david-dm.org/ikismail/Angular-ShoppingCart#info=devDependencies)
[![peerDependencies Status](https://david-dm.org/ikismail/Angular-ShoppingCart/peer-status.svg)](https://david-dm.org/ikismail/Angular-ShoppingCart?type=peer)

[![](https://img.shields.io/github/release/ikismail/Angular-ShoppingCart.svg?style=flat-square)](https://github.com/ikismail/Angular-ShoppingCart/releases)
[![npm](https://img.shields.io/badge/demo-online-brightgreen.svg)](http://angularexampleapp.com/)

Developing a **ShoppingCart (Ecommerce) Application using Angular5**.

Expand Down Expand Up @@ -41,24 +48,40 @@ This project was generated with [Angular CLI](https://github.com/angular/angular
* Service Workers
* Pipes.. etc.

#### Screenshots:

##### Home Page shot 1:

![Alt text](https://github.com/ikismail/Angular-ShoppingCart/blob/master/screenshots/home.PNG "Home Page")

##### Products Page:

![Alt text](https://github.com/ikismail/Angular-ShoppingCart/blob/master/screenshots/products.PNG "Home Page")

## Installation
# Installation

1. Angular CLI
* [Download Angular CLI](https://cli.angular.io/)
2. NodeJs
* [Download Nodejs](https://nodejs.org/en/download/)
3. Package Manager - NPM / Yarn
4. Clone the repository and run `npm install` if you use **npm** as package manager or `yarn install` if you use **yarn** as package manager.
5. Angular + Firebase Tutorial - [Angular + Firebase + Typescript — Step by step tutorial](https://medium.com/factory-mind/angular-firebase-typescript-step-by-step-tutorial-2ef887fc7d71)

6. Configure your firebase configuration `src/environments/firebaseConfig.ts`
```
export const FireBaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_AUTH_DOMAIN",
databaseURL: "YOUR_DATABASE_URL",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_STORAGE_BUCKET",
messagingSenderId: "YOUR_SENDER_ID"
};
```

7. Run the Server.

## Screenshots:

### Home Page:

![Alt text](https://github.com/ikismail/Angular-ShoppingCart/blob/master/screenshots/home.PNG "Home Page")

### Products Page:

![Alt text](https://github.com/ikismail/Angular-ShoppingCart/blob/master/screenshots/products.PNG "Home Page")

## Development server

Expand Down
26 changes: 13 additions & 13 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
basePath: "",
frameworks: ["jasmine", "@angular/cli"],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
require("karma-jasmine"),
require("karma-chrome-launcher"),
require("karma-jasmine-html-reporter"),
require("karma-coverage-istanbul-reporter"),
require("@angular/cli/plugins/karma")
],
client:{
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
reports: ["html", "lcovonly"],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
environment: "dev"
},
reporters: ['progress', 'kjhtml'],
reporters: ["progress", "kjhtml"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ["Chrome"],
singleRun: false
});
};
8 changes: 8 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
PATH=$PATH:$(npm bin)
set -x
# Production build
ng build --prod
# Serve
cd dist
http-server
28 changes: 13 additions & 15 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
// server.js
const express = require('express');
const path = require('path');
const express = require("express");
const path = require("path");
const app = express();

// If an incoming request uses
// a protocol other than HTTPS,
// redirect that request to the
// same url but with HTTPS
const forceSSL = function () {
return function (req, res, next) {
if (req.headers['x-forwarded-proto'] !== 'https') {
return res.redirect(
['https://', req.get('Host'), req.url].join('')
);
}
next();
const forceSSL = function() {
return function(req, res, next) {
if (req.headers["x-forwarded-proto"] !== "https") {
return res.redirect(["https://", req.get("Host"), req.url].join(""));
}
}
next();
};
};
// Instruct the app
// to use the forceSSL
// middleware
app.use(forceSSL());

// Run the app by serving the static files
// in the dist directory
app.use(express.static(__dirname + '/dist'));
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname + '/dist/index.html'));
app.use(express.static(__dirname + "/dist"));
app.get("/*", function(req, res) {
res.sendFile(path.join(__dirname + "/dist/index.html"));
});
// Start the app by listening on the default
// Heroku port
app.listen(process.env.PORT || 8080);
app.listen(process.env.PORT || 8080);
Loading

0 comments on commit 8d092f9

Please sign in to comment.