The value passed by the page was not received in the post request in koa

  node.js, question

1. When learning koa, the project generated by koa-generator has its own koa-bodyparser. However, when I used the post request, I found that the value passed from the page could not be received. I checked the api and found no problem.

  1. Related codes

app.js

bodyParser = require('koa-bodyparser');
 app.use(bodyParser());

new.ejs

<form class="form-horizontal" action="/users/create" method="post">
 
 <div class="form-group">
 < label for = "email" class = "col-sm-2control-label" > mailbox < /label >
 <div class="col-sm-10">
 < inputtype = "email" class = "form-control" id = "email" placeholder = "mailbox" value= "< percentage = user.email percentage >" >
 </div>
 </div>
 
 <div class="form-group">
 <div class="col-sm-offset-2 col-sm-10">
 < buttontype = "submit" class = "btnbtn-success" > submit < /button >
 < a href = "/users" class = "btnbtn-default" > return < /a >
 </div>
 </div>
 </form>

//users.js routing

var router = require('koa-router')();
 var mongoose = require('mongoose');
 var User = mongoose.model('User');
 router.get('/', list);
 router.get('/new', add);
 router.post('/create', save);
 
 function *add(next) {
 yield this.render('/users/new', {
 Title:' add user',
 user: {
 email: '',
 nickName: '',
 password: '',
 gender: 0,
 phone: 1,
 imgUrl: '',
 address: ''
 bracket
 });
 bracket
 
 function *save(next) {
 console.log(this.request.body);
 var user = this.request.body;
 user.createTime = new Date;
 user.lastLogin = new Date;
 var id = users.push(user)
 users.id = id - 1;
 this.redirect('/users');
 bracket

Attach dependency

bracket
 "name": "node-koa",
 "version": "0.1.2",
 "private": true,
 "scripts": {
 "start": "node ./bin/www"
 },
 "dependencies": {
 "co": "^4.6.0",
 "debug": "^2.2.0",
 "ejs": "~2.3.3",
 "koa": "^1.1.2",
 "koa-bodyparser": "^2.2.0",
 "koa-json": "^1.1.1",
 "koa-logger": "^1.3.0",
 "koa-mongoose": "^1.0.9",
 "koa-onerror": "^1.2.1",
 "koa-router": "^5.3.0",
 "koa-static": "^1.5.2",
 "koa-views": "^3.1.0",
 "mongoose": "^4.4.19",
 "uuid": "^2.0.2"
 },
 "devDependencies": {
 "koa-webpack-dev-middleware": "^1.2.1",
 "webpack": "^1.13.1",
 "webpack-dev-server": "^1.14.1"
 bracket
 bracket

3. Error (click to see git dynamic chart)
error

4. Project on github
node-koa

< inputtype = "email" class = "form-control" id = "email" placeholder = "email" >
 <select name="gender" id="gender" title="">

try

< inputtype = "email" class = "form-control" name = "email" id = "email" placeholder = "email" >