GithubHelp home page GithubHelp logo

siyuan's Introduction

siyuan

An SNS backend framework, with Node and MySQL

Screenshots

 

 

 

 

 

 

 

 

 

 

Install

  1. Install Node and MySQL

  2. Download or clone the repository

    git clone [email protected]:node-fun/siyuan.git
    cd siyuan
    
  3. Install dependencies and Configure

    npm install
    cp -r config.default config
    
  4. Setup the database

    node setup [environment]
    

    Usually, environment could be either development(default) or production.
    Testing records come with a development mode.

Run

node . [environment]

Test

npm test

siyuan's People

Contributors

ade951 avatar fritx avatar fvcksh1t avatar huangruichang avatar jayin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

siyuan's Issues

Now `npm test` could work

@huangruichang
I've found the reason that,
it was the timeout caused the npm test problem.
Shown that it takes more than 3000ms for db to setup,
but the default timeout is 2000ms.
However, I'm still confused -
why it goes so smoothly in WebStorm with mocha config well.

About calling `return next(err)` inside a `then`

By helping fix @ade951 's routes/groups.js, I find out an issue.
Obviously, the advantage is "simple, directly"
However, I have 2 points to tell it is not so good:

  1. It breaks the control flow, what we are trying is to -
    i) send the final message with the last then
    ii) catch every possible error with the last catch
    Such control flow is easy to handle.
    like:
// routes/starship.js
    app.post('/api/starship/unstar', function (req, res, next) {
        if (!req.user) return next(errors[21301]);
        Starship.forge(
                _.pick(req.body, 'id')
            ).fetch()
            .then(function (starship) {
                if (!starship) return Promise.reject(errors[20603]);
                if (starship.get('userid') != req.user.id) {
                    return Promise.reject(errors[20102]);
                }
                return starship.destroy();
            }).then(function () {
                next({ msg: 'Entity unstarred' });
            }).catch(next);
    });
  1. It breaks linear coding which make unnecessary "then-then nesting" ( because you returns a who-knows value in a then, you have to do everything following inside the one then ) like:
// routes/groups.js
function quit(userid, groupid, next) {
    return GroupMember.forge({
        'userid': userid,
        'groupid': groupid
    }).fetch()
        .then(function (groupMember) {
            if (!groupMember) {
                return next(errors[40001]);
            }
            return groupMember.destroy()
                .then(function () {
                    next({
                        msg: 'quit group success'
                    });
                });
        });
}

While using Promise/then, we are encouraged to follow some linear coding (all by my own comprehension)
We all hate "callback hell", don't we? :)

`NOT NULL` or `NULL`?

Which should we use with a field, NOT NULL or NULL?
Currently I think, allowing NULL with a field could bring convenience to test. xD

omit

What's the meaning of this code 'user.attributes = user.omit();' in 'routes/users.js' 👍

my problem list

4.

  • 1)Api in Group : @ade951
    it should return more detail(like name,avater.....) of one user in members

  • 2)the entity of Activity @huangruichang

    • I can't well understand userships you return .Is it mean "活动名单" in Chinese ?
    • if the answer is YES , it should return more detail(like name,avater.....) of one user in userships
  • 3)Api in Activity @huangruichang

    • in api /api/activities/find
      1)the parameter (id, statusid) is all more than 0?
      2)the parameter starttime should be number instead of string
      3)the parameter statusid has been included in status ,so it's redundancy
    • in api /api/activities/join
      1)can't not join one activity . return information:
      method :post "error" invalid api
      2)the doc you written in is "成功加入无返回值"
      to follow the API rule you should return some information like @Fritz-Lium
             { msg: 'issue updated' }

3.【fixed】

not support Chinese ?

2.Issue API 【fixed】

when I use the api like(update,delete),it return an error "Resource not found" .What worry with this?
PS: I hava login in my account and test the post(issue) api successfully.
PSS:May be I'm not well understand the descriction of API reference ?

1 . 用户注册 API 【fixed】

profile[name]       string(45)  姓名

profile[nickname] string(45) 昵称
是否觉得重复呢?这里都是校友,没有那个必要潜水什么的,直接用姓名好了。

About turning a missing `groupid` to `null`

@ade951
I still think api should be kept complete.
Anyway, admin should be able to see a list of all items.
So turning a missing groupid to null, instead of ignoring it while selecting, is wrong.
Turning it to null only when 0 is given is what I prefer.
What's your idea? :)

Ref: 2dcffc3

reset password

After that I reset password ,I still can login with the old password ina very short time.But latter a minute ,I login faild with old password . It's a bug?

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.