Skip to content

egg.js 路由传值GET,POST #2

Description

@davidkorea

GET

  1. GET查询 this.ctx.queryhostname:7001/list?id=12&name=hi,query=list?id=12&name=hi
  2. 动态传值 this.ctx.params,需要配置路由router.get('/news/:id', controller.home.news);hostname:7001/news/123,params=123

POST

  • 浏览器:{'user':'david','passwd':'11111'}
  • egg controller: this.ctx.request.body.user
  • egg router: router.post('/admin/login', controller.admin.main.Login);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions