Last active
August 25, 2016 01:25
-
-
Save mhartington/e61d68aca91215528a95a61cd2d12c98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { Http } from '@angular/http'; | |
import 'rxjs/add/operator/map'; | |
@Component({ | |
templateUrl: 'build/pages/home/home.html' | |
}) | |
export class HomePage { | |
public items; | |
constructor( | |
public http: Http | |
) { | |
this.http.get('/api/feed') | |
.map(res => res.json()) | |
.subscribe(res => this.items = res); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
app.get('/api/feed', function(req, res) { | |
res.json({ | |
name: 'feed', | |
items: ['first', 'second'] | |
}); | |
}); | |
var server = app.listen(3000, function() { | |
var host = server.address().address; | |
var port = server.address().port; | |
console.log('Example app listening at http://%s:%s', host, port); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "tmp", | |
"app_id": "", | |
"v2": true, | |
"typescript": true, | |
"proxies": [{ | |
"path": "/api", | |
"proxyUrl": "http://0.0.0.0:3000/api" | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment