• node-服务器


    原生:

    1 const http=require('http');
    2 http.createServer((request,response)=>{
    3   response.writeHead(200,{"Content-Type": "text/plain"});
    4   response.write("Hello World");
    5   response.end();
    6 }).listen(8888)
    1 const http=require('http');
    2 function onRequest(req,res){
    3   res.writeHead(200,{"Content-Type":"text/plain"});
    4   res.write('Hello World');
    5   res.end();
    6 }
    7 http.createServer(onRequest).listen(8888);

    koa:

    1 const Koa=require('koa');
    2 const app=new Koa();
    3 app.listen(8888)

    express

    1 const express=require('express');
    2 const http=require('http');
    3 const app=express();
    4 const server=http.createServer(app);
    5 server.listen(8081);
  • 相关阅读:
    sql server 去掉重复项
    mvc2.0与3.0 便利一行三个元素 便利多行代码
    新距离
    Android
    Java
    计算机文化基础期末考试复习
    立体的导航条
    腾讯微博
    1637
    私有变量
  • 原文地址:https://www.cnblogs.com/shui1993/p/10395752.html
Copyright © 2020-2023  润新知