Giter Site home page Giter Site logo

gitcard's Introduction

中文文档

About Gitcard

you can view here

Features:

  • get user info by github authorization
  • Home page show users rencently login, get more detail by user avatar
  • Comment or delete comments on Comment page
  • in Detail page, show user's basic infomation on Github (include reposity,followers,followings,etc)
  • support Follow & Unfollow operation
  • more is on the way

Server

  • Koa 2
  • MongoDB
  • Nginx

API

  • github authorization
  • user comment and delete
  • get all comments
  • get users rencently login

Tools

  • react
  • react-router
  • UI: Material UI
  • create-react-app

gitcard's People

Contributors

leeonfield avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gitcard's Issues

class 语法糖

function authUser() {};
authUser.prototype.save = function(data) {
    return new authUserModel(data).save();
};

authUser.prototype.update = function(data) {
    let condition = {
        login: data.login
    };
    return authUserModel.update(condition, data).exec();
};

authUser.prototype.find = function(condition) {
    return authUserModel.find(condition).exec();
};

module.exports = new authUser();

用class写舒服多了

class authUser {
    save(data) {
        return new authUserModel(data).save();
    }

    update(data) {
        return authUserModel.update({
            login: data.login
        }, data).exec();
    }

    find(condition) {
        return authUserModel.find(condition).exec();
    }
}

module.exports = new authUser();

关于使用request-promise的问题

我想知道,你是不是用request-promise来模拟get请求,

let option = {
        uri: 'https://github.com/login/oauth/access_token?client_id=' + clientId + '&client_secret=' + clientSecret + '&code=' + code,
        json: true
    } 
let tokenResp = await rp(option);

因为我这样发请求,406,

  StatusCodeError: 406 - " "
      at new StatusCodeError (D:\WWW\chat\node_modules\request-promise-core\lib\errors.js:32:15)
      at Request.plumbing.callback (D:\WWW\chat\node_modules\request-promise-core\lib\plumbing.js:104:33)
      at Request.RP$callback [as _callback] (D:\WWW\chat\node_modules\request-promise-core\lib\plumbing.js:46:31)
      at Request.self.callback (D:\WWW\chat\node_modules\request\request.js:186:22)
      at emitTwo (events.js:135:13)
      at Request.emit (events.js:224:7)
      at Request.<anonymous> (D:\WWW\chat\node_modules\request\request.js:1163:10)
      at emitOne (events.js:125:13)
      at Request.emit (events.js:221:7)
      at IncomingMessage.<anonymous> (D:\WWW\chat\node_modules\request\request.js:1085:12)
      at Object.onceWrapper (events.js:322:30)
      at emitNone (events.js:120:20)
      at IncomingMessage.emit (events.js:218:7)
      at endReadableNT (_stream_readable.js:1054:12)
      at _combinedTickCallback (internal/process/next_tick.js:138:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)

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.