Giter Club home page Giter Club logo

conduit's People

Contributors

dzeban avatar

Watchers

 avatar  avatar

conduit's Issues

Add logging middleware

Logging middleware is needed to see requests on the server side.
It should log in logfmt (kv) or json format.

Bio and image fields are not returned in user.Get

When quering user only email and username fields are returned.

CLI log:

(test) > user update bio=mystery
================================
PUT /users/ HTTP/1.1
Host: localhost:8080
Authorization: Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduZWQiOnRydWUsInN1YiI6InRlc3RAZXhhbXBsZS5jb20ifQ.8dbE6VKua4RQsqJZXTqisRXCBf4K5dTgBgPYHwn1ikc
Content-Type: application/json

{
  "user": {
    "username": "",
    "email": "",
    "bio": "mystery"
  }
}

--------------------------------
HTTP/1.1 200 OK
Content-Length: 201
Content-Type: text/plain; charset=utf-8
Date: Sun, 23 Jun 2019 20:24:30 GMT

{
  "user": {
    "username": "test",
    "email": "[email protected]",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduZWQiOnRydWUsInN1YiI6InRlc3RAZXhhbXBsZS5jb20ifQ.8dbE6VKua4RQsqJZXTqisRXCBf4K5dTgBgPYHwn1ikc"
  }
}

================================
[update current user and token]
(test) > user get
================================
GET /users/ HTTP/1.1
Host: localhost:8080
Authorization: Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduZWQiOnRydWUsInN1YiI6InRlc3RAZXhhbXBsZS5jb20ifQ.8dbE6VKua4RQsqJZXTqisRXCBf4K5dTgBgPYHwn1ikc
Content-Type: application/json

null

--------------------------------
HTTP/1.1 200 OK
Content-Length: 55
Content-Type: text/plain; charset=utf-8
Date: Sun, 23 Jun 2019 20:24:38 GMT

{
  "user": {
    "username": "test",
    "email": "[email protected]"
  }
}

================================
(test) > user update image=aaaa
================================
PUT /users/ HTTP/1.1
Host: localhost:8080
Authorization: Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduZWQiOnRydWUsInN1YiI6InRlc3RAZXhhbXBsZS5jb20ifQ.8dbE6VKua4RQsqJZXTqisRXCBf4K5dTgBgPYHwn1ikc
Content-Type: application/json

{
  "user": {
    "username": "",
    "email": "",
    "image": "aaaa"
  }
}

--------------------------------
HTTP/1.1 200 OK
Content-Length: 201
Content-Type: text/plain; charset=utf-8
Date: Sun, 23 Jun 2019 20:28:23 GMT

{
  "user": {
    "username": "test",
    "email": "[email protected]",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduZWQiOnRydWUsInN1YiI6InRlc3RAZXhhbXBsZS5jb20ifQ.8dbE6VKua4RQsqJZXTqisRXCBf4K5dTgBgPYHwn1ikc"
  }
}

================================
[update current user and token]
(test) > user get
================================
GET /users/ HTTP/1.1
Host: localhost:8080
Authorization: Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduZWQiOnRydWUsInN1YiI6InRlc3RAZXhhbXBsZS5jb20ifQ.8dbE6VKua4RQsqJZXTqisRXCBf4K5dTgBgPYHwn1ikc
Content-Type: application/json

null

--------------------------------
HTTP/1.1 200 OK
Content-Length: 55
Content-Type: text/plain; charset=utf-8
Date: Sun, 23 Jun 2019 20:28:27 GMT

{
  "user": {
    "username": "test",
    "email": "[email protected]"
  }
}

================================

Here is the db:

conduit=# select * from users where email='[email protected]';
 id | name |      email       |   bio   | image |                                                                   password                                                                   
----+------+------------------+---------+-------+----------------------------------------------------------------------------------------------------------------------------------------------
  1 | test | [email protected] | mystery | aaaa  | $argon2id$v=19$m=32768,t=5,p=1$5W65rnCtWdAY6nmGX5Rz8g$gu5pIxhcGAUl6Nh8Fsow1G1pQMRT6Bya30miquBrlOG8sTnzuqmV960a7Wdbgij/tu6BpJTfjPjgFca1c9Csmw

I think it has something with sql.NullString because only these 2 fields are declared with this type:

	var bio, image sql.NullString

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.