Skip to content

Commit

Permalink
Make project ready to deploy to heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
rokinmaharjan committed Mar 11, 2018
1 parent ca18d57 commit 5e8790a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "node server.js",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"e2e": "ng e2e",
"postinstall": "ng build --aot -prod"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/cli": "~1.7.2",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/compiler-cli": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
Expand All @@ -23,8 +26,10 @@
"@angular/router": "^5.2.0",
"bootstrap": "^4.0.0",
"core-js": "^2.4.1",
"express": "^4.16.2",
"jquery": "^3.3.1",
"rxjs": "^5.5.6",
"typescript": "~2.5.3",
"zone.js": "^0.8.19"
},
"devDependencies": {
Expand All @@ -35,6 +40,7 @@
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"enhanced-resolve": "^3.3.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
Expand All @@ -46,5 +52,9 @@
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
},
"engines": {
"node": "7.9.0",
"npm": "4.2.0"
}
}
9 changes: 9 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//Install express server
const express = require('express');
const app = express();

// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist'));

// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
10 changes: 4 additions & 6 deletions src/app/quote/quote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ import {HttpClient} from "@angular/common/http";

@Injectable()
export class QuoteService {
// private GET_ALL_QUOTES_URL = 'https://quotehouse-backend.herokuapp.com/quotes';
// private POST_QUOTE_URL = 'https://quotehouse-backend.herokuapp.com/quotes/quote';
private GET_ALL_QUOTES_URL = 'https://quotehouse-backend.herokuapp.com/quotes';
private POST_QUOTE_URL = 'https://quotehouse-backend.herokuapp.com/quotes/quote';

private quotes: Quote[] = [];

constructor(private http: HttpClient) {
}

getQuotes(): Observable<Object> {
// return this.http.get(this.GET_ALL_QUOTES_URL);
return null;
return this.http.get(this.GET_ALL_QUOTES_URL);
}

addQuote(quote: Quote): Observable<Object> {
// return this.http.post(this.POST_QUOTE_URL, quote);
return null;
return this.http.post(this.POST_QUOTE_URL, quote);
}
}

0 comments on commit 5e8790a

Please sign in to comment.