This file contains hidden or 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
'use strict'; | |
let httpServer | |
, http = require('http') | |
, path = require('path') | |
, url = require('url') | |
, fs = require('fs'); | |
let port = process.env.www_port || 3000; | |
let mimeTypes = { |
This file contains hidden or 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
//https://github.com/daithiw44/MAL/blob/master/examples/geo/server.js | |
//geoNaear | |
var MAL = require('../../lib/mal').MAL; | |
// Easy Way: Fire up a local instance of MongoDB | |
// settings object (username and password are not compulsory) | |
var dbsettings = { | |
host: 'localhost', | |
port: 27017, | |
db: 'malexamples', | |
options: {auto_reconnect: true} |
This file contains hidden or 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
/* | |
* Access the profile image (Twitter GET users/profile_image/:screen_name) for a user with the indicated screen_name. | |
* Currently this resource does not return JSON (or XML), but instead returns a 302 redirect to the actual image resource. | |
* Use requests request.head with option followRedirect set to false to get the image file name from the json in the header response. | |
* Using the image file URL get the profile image and convert to base64 encoding to use as in this example as data URI (which could be saved to a DB/storage etc for later use etc). | |
* example call : http://127.0.0.1:4444/?screen_name=daithi44 | |
*/ | |
var http = require('http'), | |
request = require('request'), |
This file contains hidden or 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
/* | |
* Access the profile image in various sizes for the user with the indicated screen_name. | |
* Currently this resource does not return JSON (or XML), but instead returns a 302 redirect to the actual image resource. | |
* Use requests request.head with option followRedirect set to false to get the image file name from the json in the header response. | |
* example : http://127.0.0.1:4400/?screen_name=daithi44 | |
*/ | |
var http = require('http') | |
, request = require('request') | |
, url = require('url'); |
This file contains hidden or 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
// Updated example to utilize 'basic' Domains with express. | |
// Website Scraper that scrapes off a site (without permission I may add) | |
// had seen some screen scraping examples using jQuery this example is jQuery-less. | |
var express = require('express'), | |
request = require('request'), | |
jsdom = require('jsdom'), | |
builder = require('xmlbuilder').create(), | |
sys = require('util'), | |
createDomain = require('domain').create, | |
app = express.createServer(); |
This file contains hidden or 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
//Web Scraper that scrapes a web page (without permission I may add). | |
//Simple test using node is all this is, no error handling etc. | |
//Returns JSON OR XML | |
//Format : localhost:'PORT'/scrape/'WORD'/'FORMAT' | |
//Example CURL | |
//JSON - curl -X GET http://localhost:3000/scrape/fundamental/json | |
//XML - curl -X GET http://localhost:3000/scrape/fundamental/xml | |
var express = require('express'), | |
request = require('request'), |