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
| <configuration> | |
| <property> | |
| <name>fs.defaultFS</name> | |
| <value>hdfs://localhost:9000</value> | |
| </property> | |
| </configuration> |
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
| # set to the root of your Java installation | |
| export JAVA_HOME=/usr/lib/jvm/<your-java-version> | |
| export PATH=${JAVA_HOME}/bin:${PATH} | |
| export HADOOP_CLASSPATH=$JAVA_HOME/lib/tools.jar |
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
| function logHeaders(req, res, next){ | |
| console.log(req.headers); | |
| next(); | |
| } | |
| function logURL(req, res, next){ | |
| console.log(req.url); | |
| next(); | |
| } |
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
| function logFirst(req, res, next){ | |
| console.log("First!"); | |
| next(); | |
| } | |
| function logSecond(req, res, next){ | |
| console.log("Second!"); | |
| next(); | |
| } |
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
| // First middleware | |
| app.use(function(req, res, next){ | |
| console.log("Started"); | |
| next(); | |
| }); | |
| // Route handler | |
| app.get('/', function(req, res, next){ | |
| res.send("Sent to client"); | |
| next(); |
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
| function NewLogger(req, res, next){ | |
| console.log("A request was received at /new"); | |
| next(); | |
| } | |
| app.use('/new', NewLogger); |
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
| var app = require('express')(); | |
| function logger(req, res, next){ | |
| console.log("A %s request was received at %s", req.method, req.url); | |
| next(); | |
| } | |
| // Use the middleware function | |
| app.use(logger); |
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
| function LogRequsts(req, res, next){ | |
| console.log("A request was received!"); | |
| next(); | |
| } |
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
| var express = require("express"); | |
| var app = express(); | |
| function randomString(length) { | |
| var result = ''; | |
| var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| for (var i = length; i > 0; --i) | |
| result += chars[Math.floor(Math.random() * chars.length)]; | |
| return result; |
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
| /** | |
| * Using Rails-like standard naming convention for endpoints. | |
| * GET /api/things -> index | |
| * POST /api/things -> create | |
| * GET /api/things/:id -> show | |
| * PUT /api/things/:id -> update | |
| * DELETE /api/things/:id -> destroy | |
| */ | |
| 'use strict'; |