兄弟会0808(nodejs httpサービス)

2927 ワード

Vimエディタのショートカットキー:
vim    :
a             
A             
i             
I             
o           
O           


:set nu         
:set nonu       
gg              
G              
nG          n 
:n         n 
$             
0( )          

x                    
nx              n   
dd                 ,ndd  n 
dG                    
D                     
:nl,n2d               :100,110d

yy               
nyy                n 
dd           
ndd                n 
p、P                       

r                    
R                       , Ese  
u                  

:%s/old/new/g              old new
%s        
g       
c      

    :
:w        
:wq          
:q!          
:wq!         (      root    )
ZZ           
サービスコード:
1.   http  
const http = require('http');
2.     
var service = http.createServer( (req, res) => {
    //       
    console.log(req);
    //   
    res.writeHead(200, {'Content-Type': 'text/plain'});
    //    
    res.end('okay');
});
3.     
service.listen(1337, '192.168.1.118', () => {
    console.log('service OK');
});
request要求情報(http://192.168.1.118:1337)
//s's     
IncomingMessage {
    //   
    headers: 
        {
            //     /  
            host: '192.168.1.118:1337',
            //    
            connection: 'keep-alive',
            pragma: 'no-cache',
            //    
            'cache-control': 'no-cache',
            //    :     
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36',
            accept: '*/*',
            //    
            referer: 'http://192.168.1.118:1337/',
            //  
            'accept-encoding': 'gzip, deflate, sdch',
            //  
            'accept-language': 'zh-CN,zh;q=0.8' 
        },
    rawHeaders: 
        [
            'Host',
            '192.168.1.118:1337',
            'Connection',
            'keep-alive',
            'Pragma',
            'no-cache',
            'Cache-Control',
            'no-cache',
            'User-Agent',
            'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36',
            'Accept',
            '*/*',
            'Referer',
            'http://192.168.1.118:1337/',
            'Accept-Encoding',
            'gzip, deflate, sdch',
            'Accept-Language',
            'zh-CN,zh;q=0.8' 
        ],
        trailers: {},
        rawTrailers: [],
        upgrade: false,
        url: '/favicon.ico',
        method: 'GET'
}