text: if(path === '/'){
      let string = fs.readFileSync('./index.html', 'utf8')
      let cookies =  request.headers.cookie.split('; ') // ['email=1@', 'a=1', 'b=2']
      let hash = {}
      for(let i =0;i<cookies.length; i++){
        let parts = cookies[i].split('=')
        let key = parts[0]
        let value = parts[1]
        hash[key] = value 
      }
      let email = hash.sign_in_email
      let users = fs.readFileSync('./db/users', 'utf8')
      users = JSON.parse(users)
      let foundUser
      for(let i=0; i< users.length; i++){
        if(users[i].email === email){
          foundUser = users[i]
          break
        }
      }
      console.log(foundUser)
      if(foundUser){
        string = string.replace('__password__', foundUser.password)
      }else{
        string = string.replace('__password__', '不知道')
      }
      response.statusCode = 200
      response.setHeader('Content-Type', 'text/html;charset=utf-8')
      response.write(string)
      response.end()
    }else if(path === '/sign_up' && method === 'GET'){ 
      let string = fs.readFileSync('./sign_up.html', 'utf8')
      response.statusCode = 200
      response.setHeader('Content-Type', 'text/html;charset=utf-8')
      response.write(string)
      response.end()
    }else if(path === '/sign_up' && method === 'POST'){
      readBody(request).then((body)=>{
        let strings = body.split('&') // ['email=1', 'password=2', 'password_confirmation=3']
        let hash = {}
        strings.forEach((string)=>{
          // string == 'email=1'
          let parts = string.split('=') // ['email', '1']
          let key = parts[0]
          let value = parts[1]
          hash[key] = decodeURIComponent(value) // hash['email'] = '1'
        })
        let {email, password, password_confirmation} = hash
        if(email.indexOf('@') === -1){
          response.statusCode = 400
          response.setHeader('Content-Type', 'application/json;charset=utf-8')
          response.write(`{
            "errors": {
              "email": "invalid"
            }
          }`)
        }else if(password !== password_confirmation){
          response.statusCode = 400
          response.write('password not match')
        }else{
          var users = fs.readFileSync('./db/users', 'utf8')
          try{
            users = JSON.parse(users) // []
          }catch(exception){
            users = []
          }
          let inUse = false
          for(let i=0; i<users.length; i++){
            let user = users[i]
            if(user.email === email){
              inUse = true
              break;
            }
          }
          if(inUse){
            response.statusCode = 400
            response.write('email in use')
          }else{
            users.push({email: email, password: password})
            var usersString = JSON.stringify(users)
            fs.writeFileSync('./db/users', usersString)
            response.statusCode = 200
          }
        }
        response.end()
      })
    }else if(path==='/sign_in' && method === 'GET'){
      let string = fs.readFileSync('./sign_in.html', 'utf8')
      response.statusCode = 200
      response.setHeader('Content-Type', 'text/html;charset=utf-8')
      response.write(string)
      response.end()
    }else if(path==='/sign_in' && method === 'POST'){
      readBody(request).then((body)=>{
        let strings = body.split('&') // ['email=1', 'password=2', 'password_confirmation=3']
        let hash = {}
        strings.forEach((string)=>{
          // string == 'email=1'
          let parts = string.split('=') // ['email', '1']
          let key = parts[0]
          let value = parts[1]
          hash[key] = decodeURIComponent(value) // hash['email'] = '1'
        })
        let {email, password} = hash
        var users = fs.readFileSync('./db/users', 'utf8')
        try{
          users = JSON.parse(users) // []
        }catch(exception){
          users = []
        }
        let found
        for(let i=0;i<users.length; i++){
          if(users[i].email === email && users[i].password === password){
            found = true
            break
          }
        }
        if(found){
          response.setHeader('Set-Cookie', `sign_in_email=${email}`)
          response.statusCode = 200
        }else{
          response.statusCode = 401
        }
        response.end()
      })
    }else if(path==='/main.js'){
      let string = fs.readFileSync('./main.js', 'utf8')
      response.statusCode = 200
      response.setHeader('Content-Type', 'text/javascript;charset=utf-8')
      response.write(string)
      response.end()
    }else if(path==='/xxx'){
      response.statusCode = 200
      response.setHeader('Content-Type', 'text/json;charset=utf-8')
      response.setHeader('Access-Control-Allow-Origin', 'http://frank.com:8001')
      response.write(`
      {
        "note":{
          "to": "小谷",
          "from": "方方",
          "heading": "打招呼",
          "content": "hi"
        }
      }
      `)
      response.end()
    }else{
      response.statusCode = 404
      response.setHeader('Content-Type', 'text/html;charset=utf-8')
      response.write(`
        {
          "error": "not found"
        }
      `)
      response.end()
    }