Git Product home page Git Product logo

fork2-mini-harp's Introduction

Lesson 1 - Mini Harp Static Server

concept

  • factory function
  • middleware
  • http server
  • what’s harp
  • how to use it

http protocol

  • Transfer-Encoding: chunked
  • HTTP 303 status && Location Header
    • wiki link
    • in server-static: to modify pathname and redirect to it.

--save-dev and --save

–save: Package will appear in your dependencies.

–save-dev: Package will appear in your devDependencies.

  • !== vs ||
/* version !==:
  only b = flase then  a = flase, else a = true, so defalut is true;
  and the most important you only have choice of true or flase;
  it is very useful if you are setting a boolean value in options.
*/
var a = false !== b;
var a = true !== b; //defalut is false;
/* version ||
 flase:  b = undefined or 0 or null or false then a = flase  else a = b , defalut is false,
 this mothod can not solve defalut is true.
*/
var a = b || false;
var a = b || true; //are you kidding?
  • support GET , HEAD
  • require ‘url’
    • url.parse to get a url object?
    • and then you can use Object.pathname
    • url.format
  • require ‘send’
  • next, next()
    • next(err)
  • exports.mime
    • provide MIME type : to deal with non ASIC2 docutment.
  • escape()
    • to replace some words to other words…

Lesson 2 - Mini Harp Preprocessors

question

  1. fs.readFile里面的 data 无法传出去? **!回调会在你后面赋值之后才执行啊!
  2. 不指名statuscode的话是如何返回状态码的?

jade&&less

  • how it run?
  • why not use it ?

HTTP Content-type

fork2-mini-harp's People

Contributors

cnmpp902 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.