Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = require('express').createServer(),
- fs = require('fs'),
- geolib = require('./geolib').geolib,
- http = require('http');
- app.get('/', function(req, res){
- res.send('Hello World');
- });
- app.get('/distance/:lat1/:lng1/:lat2/:lng2', function(req, res){
- var distance = geolib.getDistance({latitude: req.params.lat1, longitude: req.params.lng1 }, {latitude: req.params.lat2, longitude: req.params.lng2});
- res.send('Distance from ' + req.params.lat1 + ',' + req.params.lng1 + ' to ' + req.params.lat2 + ',' + req.params.lng2 + ' is ' + distance + ' km');
- });
- app.get('/twitter', function(req, res){
- http.request(
- {
- host: 'api.twitter.com',
- port: 80,
- method: 'GET',
- path: '/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=manuelbieh&count=2'
- },
- function(resp) {
- //console.log(resp);
- //res.send(JSON.stringify(resp.headers));
- }
- );
- res.send('twitter');
- });
- app.listen(3000);
Add Comment
Please, Sign In to add comment