Giter VIP home page Giter VIP logo

goweb's Introduction

GoWeb

This project is built for study

Author

Irene Liu

goweb's People

Contributors

ireneliuqaq avatar

Watchers

James Cloos avatar Lucien avatar

goweb's Issues

第三次作业 - HTTP status code & 异常捕获 & Body

  1. HTTP status code

  2. 学习捕获持久层异常

  3. #1 中的 username 置为主键,并执行以下两次 POST

    POST /user/register?username=lucien&nickname=handsome
    POST /user/register?username=lucien&nickname=handsome

    第一次插入应该是成功的,第二次插入时数据库会抛出 error,因为 username 是主键,数据库会 conflict,此时应返回相应的错误信息,例如:

    {
        "code": 409,
        "message": "duplicated username"
    }
  4. 将之前的所有从 form 获取数据的 API 改为从 body 获取数据

第二次作业 - gorm & sqlite

  1. 了解 gorm 和 sqlite(关键字:golang gorm sqlite)
  2. 实现两个接口
    • 2.1 POST /user/register?username=&nickname= 注册一个用户名为 username,昵称为 nickname 的用户,无需密码
      • 返回 codemessage 字段
    • 2.2 GET /user/:username 查询 username 对应的 nickname
      • 返回 nicknamecodemessage 字段

Hint

  1. POST /user/register?username=lucien&nickname=handsom

    注册一个 ID 为 lucien 昵称为 username 的用户

    • response

      {
          "code": 201,
          "message": "success"
      }
  2. GET /user/lucien
    查询 luciennickname

    • response

      {
          "code": 200,
          "message": "success",
          "nickname": "handsom"
      }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.