File: requestHandlers.js

Recommend this page to a friend!
  Classes of Igor Escobar  >  Terminal Crossword  >  requestHandlers.js  >  Download  
File: requestHandlers.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Terminal Crossword
Generate a crosswords board on a text console
Author: By
Last change:
Date: 5 months ago
Size: 789 bytes


Class file image Download
function start(response) {
  console.log("Request handler 'start' was called.");

  var body = '<html>'+
    '<meta http-equiv="Content-Type" content="text/html; '+
    'charset=UTF-8" />'+
    '<form action="/upload" method="post">'+
    '<textarea name="text" rows="20" cols="60"></textarea>'+
    '<input type="submit" value="Submit text" />'+

    response.writeHead(200, {"Content-Type": "text/html"});

function upload(response) {
  console.log("Request handler 'upload' was called.");
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello Upload");

exports.start = start;
exports.upload = upload;