server.js
var Koa = require("koa");
var Router = require("koa-router");
var fs = require("fs");
var bodyParser = require("koa-bodyparser");
var app = new Koa();
var router = new Router();
app.use(bodyParser());
router.get("/", async (ctx, next) => {
ctx.type = "html";
ctx.body = fs.createReadStream("index.html");
});
router.post("/save", async (ctx, next) => {
ctx.body = ctx.request.body;
});
app.use(router.routes()).use(router.allowedMethods());
app.listen(3000);
console.log("server started at http:localhost:3000");
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 关于在接收POST请求,Tomcat偶发性接收到的参数不全问题排查分析
- 异步接收MSMQ消息
- 如何突破商品期货Tick接收限制
- SpringMVC接收和响应json数据
- 如何使用 jq 接收 blob 数据
- 转的关于公众号接收信息的返回
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Web 2.0 Architectures
Duane Nickull、Dion Hinchcliffe、James Governor / O'Reilly / 2009 / USD 34.99
The "Web 2.0" phenomena has become more pervasive than ever before. It is impacting the very fabric of our society and presents opportunities for those with knowledge. The individuals who understand t......一起来看看 《Web 2.0 Architectures》 这本书的介绍吧!