GithubHelp home page GithubHelp logo

n-club's Introduction

n-club's People

Contributors

nswbmw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

n-club's Issues

如何在路由里引入验证中间件

比如N-Club的的路由
http://localhost:3000/topic/57d65f08c0d001f037b165da

如何让只有已经登陆的用户查看这个主题,未登录的用户,跳转到登录页面,登录以后,再自动跳转回来

SyntaxError: Invalid Unicode escape sequence in "index.ejs"

Server listening on: 3000
<-- GET /
xxx GET / 500 158ms -

SyntaxError: Invalid Unicode escape sequence in "index.ejs"
at exports.compile (D:\node\N-club-master\node_modules.1.5.2@co-ejs\lib\ejs.js:339:15)
at exports.render (D:\node\N-club-master\node_modules.1.5.2@co-ejs\lib\ejs.js:381:66)
at next (native)
at exports.renderFile (D:\node\N-club-master\node_modules.1.5.2@co-ejs\lib\ejs.js:412:17)
at next (native)
at Object.app.context.render (D:\node\N-club-master\node_modules.1.5.2@co-ejs\lib\ejs.js:167:23)
at next (native)
at onFulfilled (D:\node\N-club-master\node_modules.4.6.0@co\index.js:65:19)

建议升级到2.0

再结合aync wait搞一版 nodejs的书真是一买就过时( ▼-▼ ) 容许我先去哭一会儿

关于generator的问题

var userExist = yield $User.getUserByName(data.name);
if(userExist) {
//......
}

yield不是没有返回值的吗?下面这个程序a的值也没打印出来,为什么上面的程序,userExist会被赋值呢

> function *con() {
... var a = yield function() {
..... return 1;
..... }
... console.log(a);
... console.log('b');
... }
undefined
> con()
{}
> var a = con()
undefined
> a.next()
{ value: [Function], done: false }
> a.next()
undefined
b
{ value: undefined, done: true }

源码

这个源码能跑起来嘛,下下来之后跑不起来,已经将mongo的数据库建立连接起来,作者能不能发一份跑起来的源码给我和数据库建表的 谢谢

refresh session error: Cannot read property 'done' of undefined

 koa-generic-session:session session id not exist, generate a new one +10s
  koa-route GET /signup matches /signup [] +5ms

  koa-generic-session:session new session and do not modified +4ms
  koa-generic-session:session refresh session error: Cannot read property 'done' of undefined +1ms
  xxx GET /signup 500 13ms -

  TypeError: Cannot read property 'done' of undefined
      at next (/work/learn/learnkoa/node_modules/co/index.js:98:14)
      at onFulfilled (/work/learn/learnkoa/node_modules/co/index.js:69:7)
      at /work/learn/learnkoa/node_modules/co/index.js:54:5
      at Object.co (/work/learn/learnkoa/node_modules/co/index.js:50:10)
      at Object.toPromise (/work/learn/learnkoa/node_modules/co/index.js:118:63)
      at next (/work/learn/learnkoa/node_modules/co/index.js:99:29)
      at onFulfilled (/work/learn/learnkoa/node_modules/co/index.js:69:7)
      at process._tickCallback (internal/process/next_tick.js:103:7)

  <-- GET /favicon.ico
  koa-generic-session:session session id not exist, generate a new one +176ms
  koa-generic-session:session new session and do not modified +6ms
  koa-generic-session:session refresh session error: Cannot read property 'done' of undefined +0ms
  xxx GET /favicon.ico 500 8ms -

  TypeError: Cannot read property 'done' of undefined
      at next (/work/learn/learnkoa/node_modules/co/index.js:98:14)
      at onFulfilled (/work/learn/learnkoa/node_modules/co/index.js:69:7)
      at /work/learn/learnkoa/node_modules/co/index.js:54:5
      at Object.co (/work/learn/learnkoa/node_modules/co/index.js:50:10)
      at Object.toPromise (/work/learn/learnkoa/node_modules/co/index.js:118:63)
      at next (/work/learn/learnkoa/node_modules/co/index.js:99:29)
      at onFulfilled (/work/learn/learnkoa/node_modules/co/index.js:69:7)
      at process._tickCallback (internal/process/next_tick.js:103:7)

mac 笔记本,启动后 访问http://localhost:3000/signup

就会报上面的问题,

@nswbmw

koa-generic-session set error: Cannot read property 'maxAge' of undefined

koa-generic-session 和 koa-generic-session-mongo 中相关的配置:
app.js

app.use(session({
  store: new MongoStore(config.mongodb)
}));

config/default.js

  mongodb: {
    url: 'mongodb://127.0.0.1:27017/club'
  },

每次post /signin 时候执行到
routes/signin.js

  this.session = {
    user: userInfo.name,
    email: userInfo.email
  };

就报错:

koa-generic-session set error: Cannot read property 'maxAge' of undefined
    at MongoStore.set$ (f:\Users\dev\bbs\node_modules\koa-generic-session-mongo\dist\store.js:195:33)
    at tryCatch (f:\Users\dev\bbs\node_modules\babel-runtime\regenerator\runtime.js:72:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (f:\Users\dev\bbs\node_modules\babel-runtime\regenerator\runtime.js:334:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (f:\Users\dev\bbs\node_modules\babel-runtime\regenerator\runtime.js:105:21)
    at onFulfilled (f:\Users\dev\bbs\node_modules\co\index.js:65:19)
    at f:\Users\dev\bbs\node_modules\co\index.js:54:5
    at Object.co (f:\Users\dev\bbs\node_modules\co\index.js:50:10)
    at Object.toPromise (f:\Users\dev\bbs\node_modules\co\index.js:118:63)
    at next (f:\Users\dev\bbs\node_modules\co\index.js:99:29)
    at onFulfilled (f:\Users\dev\bbs\node_modules\co\index.js:69:7)
    at f:\Users\dev\bbs\node_modules\co\index.js:54:5
    at Object.co (f:\Users\dev\bbs\node_modules\co\index.js:50:10)
    at Object.toPromise (f:\Users\dev\bbs\node_modules\co\index.js:118:63)
    at next (f:\Users\dev\bbs\node_modules\co\index.js:99:29)
    at onFulfilled (f:\Users\dev\bbs\node_modules\co\index.js:69:7)
    at f:\Users\dev\bbs\node_modules\co\index.js:54:5

windows开发环境,一直找不到原因,求助 @nswbmw

测试的问题

发现在发送post请求的时候,数据经过scheme检测数据类型。但是即使数据是错误的,仍然能通过

关于在heroku部署的问题?

我在本地调试成功了,但是部署到heroku的时候,访问地址出现下面的情况:

Application Error
An error occurred in the application and your page could not be served. 
Please try again in a few moments.

If you are the application owner, check your logs for details.

然后查看heroku logs(没有看懂),请教一下这是哪里除了问题?

heroku logs
2015-10-24T11:52:04.305187+00:00 heroku[api]: Enable Logplex by quoniamy@gmail.com
2015-10-24T11:52:04.305187+00:00 heroku[api]: Release v2 created by quoniamy@gmail.com
2015-10-24T11:55:22.335600+00:00 heroku[slug-compiler]: Slug compilation started
2015-10-24T11:55:22.335610+00:00 heroku[slug-compiler]: Slug compilation finished
2015-10-24T11:55:22.168034+00:00 heroku[api]: Scale to web=1 by quoniamy@gmail.com
2015-10-24T11:55:22.244773+00:00 heroku[api]: Deploy e1c7aa8 by quoniamy@gmail.com
2015-10-24T11:55:22.244773+00:00 heroku[api]: Release v3 created by quoniamy@gmail.com
2015-10-24T11:55:23.126384+00:00 heroku[web.1]: Starting process with command `npm start`
2015-10-24T11:55:24.358943+00:00 app[web.1]: 
2015-10-24T11:55:24.358950+00:00 app[web.1]: > V-club@0.0.1 start /app
2015-10-24T11:55:24.358951+00:00 app[web.1]: > NODE_ENV=default DEBUG=* node --harmony app
2015-10-24T11:55:24.358952+00:00 app[web.1]: 
2015-10-24T11:55:24.905440+00:00 app[web.1]: module.js:338
2015-10-24T11:55:24.921552+00:00 app[web.1]: npm ERR! Linux 3.13.0-66-generic
2015-10-24T11:55:24.921935+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-10-24T11:55:24.922128+00:00 app[web.1]: npm ERR! node v0.12.2
2015-10-24T11:55:24.922485+00:00 app[web.1]: npm ERR! npm  v2.7.4
2015-10-24T11:55:24.922642+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-10-24T11:55:24.922900+00:00 app[web.1]: npm ERR! Exit status 1
2015-10-24T11:55:24.922789+00:00 app[web.1]: npm ERR! V-club@0.0.1 start: `NODE_ENV=default DEBUG=* node --harmony app`
2015-10-24T11:55:24.923062+00:00 app[web.1]: npm ERR! 
2015-10-24T11:55:24.923132+00:00 app[web.1]: npm ERR! Failed at the V-club@0.0.1 start script 'NODE_ENV=default DEBUG=* node --harmony app'.
2015-10-24T11:55:24.923263+00:00 app[web.1]: npm ERR! This is most likely a problem with the V-club package,
2015-10-24T11:55:24.923372+00:00 app[web.1]: npm ERR! not with npm itself.
2015-10-24T11:55:24.905470+00:00 app[web.1]:     throw err;
2015-10-24T11:55:24.905471+00:00 app[web.1]:     ^
2015-10-24T11:55:24.923465+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-10-24T11:55:24.923668+00:00 app[web.1]: npm ERR! You can get their info via:
2015-10-24T11:55:24.923570+00:00 app[web.1]: npm ERR!     NODE_ENV=default DEBUG=* node --harmony app
2015-10-24T11:55:24.923773+00:00 app[web.1]: npm ERR!     npm owner ls V-club
2015-10-24T11:55:24.923882+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-10-24T11:55:24.926338+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2015-10-24T11:55:24.905474+00:00 app[web.1]:     at Function.Module._load (module.js:278:25)
2015-10-24T11:55:24.926238+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-10-24T11:55:24.925971+00:00 app[web.1]: 
2015-10-24T11:55:24.905473+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
2015-10-24T11:55:24.905474+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-10-24T11:55:24.905476+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-10-24T11:55:24.905472+00:00 app[web.1]: Error: Cannot find module 'gravatar'
2015-10-24T11:55:24.905475+00:00 app[web.1]:     at require (module.js:384:17)
2015-10-24T11:55:24.905477+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-10-24T11:55:24.905476+00:00 app[web.1]:     at Object.<anonymous> (/app/theme/helpers/filters.js:1:78)
2015-10-24T11:55:24.905478+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-10-24T11:55:24.905478+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-10-24T11:55:24.905479+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-10-24T11:55:24.917845+00:00 app[web.1]: 
2015-10-24T11:55:24.905480+00:00 app[web.1]:     at require (module.js:384:17)
2015-10-24T11:55:25.553391+00:00 heroku[web.1]: Process exited with status 1
2015-10-24T11:55:25.555369+00:00 heroku[web.1]: State changed from crashed to starting
2015-10-24T11:55:25.554197+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-24T11:55:26.625822+00:00 heroku[web.1]: Starting process with command `npm start`
2015-10-24T11:55:28.830544+00:00 app[web.1]: 
2015-10-24T11:55:28.830562+00:00 app[web.1]: > V-club@0.0.1 start /app
2015-10-24T11:55:28.830564+00:00 app[web.1]: > NODE_ENV=default DEBUG=* node --harmony app
2015-10-24T11:55:28.830565+00:00 app[web.1]: 
2015-10-24T11:55:29.522872+00:00 app[web.1]: npm ERR! Linux 3.13.0-66-generic
2015-10-24T11:55:29.523269+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-10-24T11:55:29.523470+00:00 app[web.1]: npm ERR! node v0.12.2
2015-10-24T11:55:29.523847+00:00 app[web.1]: npm ERR! npm  v2.7.4
2015-10-24T11:55:29.524185+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-10-24T11:55:29.524485+00:00 app[web.1]: npm ERR! V-club@0.0.1 start: `NODE_ENV=default DEBUG=* node --harmony app`
2015-10-24T11:55:29.524606+00:00 app[web.1]: npm ERR! Exit status 1
2015-10-24T11:55:29.524800+00:00 app[web.1]: npm ERR! 
2015-10-24T11:55:29.524927+00:00 app[web.1]: npm ERR! Failed at the V-club@0.0.1 start script 'NODE_ENV=default DEBUG=* node --harmony app'.
2015-10-24T11:55:29.525065+00:00 app[web.1]: npm ERR! This is most likely a problem with the V-club package,
2015-10-24T11:55:29.525181+00:00 app[web.1]: npm ERR! not with npm itself.
2015-10-24T11:55:29.525408+00:00 app[web.1]: npm ERR!     NODE_ENV=default DEBUG=* node --harmony app
2015-10-24T11:55:29.525296+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-10-24T11:55:29.525546+00:00 app[web.1]: npm ERR! You can get their info via:
2015-10-24T11:55:29.525657+00:00 app[web.1]: npm ERR!     npm owner ls V-club
2015-10-24T11:55:29.525786+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-10-24T11:55:29.527852+00:00 app[web.1]: 
2015-10-24T11:55:29.528170+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-10-24T11:55:29.528344+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2015-10-24T11:55:29.509126+00:00 app[web.1]: module.js:338
2015-10-24T11:55:29.509129+00:00 app[web.1]:     ^
2015-10-24T11:55:29.509128+00:00 app[web.1]:     throw err;
2015-10-24T11:55:29.509130+00:00 app[web.1]: Error: Cannot find module 'gravatar'
2015-10-24T11:55:29.509131+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
2015-10-24T11:55:29.509131+00:00 app[web.1]:     at Function.Module._load (module.js:278:25)
2015-10-24T11:55:29.509132+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-10-24T11:55:29.509132+00:00 app[web.1]:     at require (module.js:384:17)
2015-10-24T11:55:29.509133+00:00 app[web.1]:     at Object.<anonymous> (/app/theme/helpers/filters.js:1:78)
2015-10-24T11:55:29.509133+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-10-24T11:55:29.509134+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-10-24T11:55:29.509134+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-10-24T11:55:29.509135+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-10-24T11:55:29.519168+00:00 app[web.1]: 
2015-10-24T11:55:29.509135+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-10-24T11:55:29.509136+00:00 app[web.1]:     at require (module.js:384:17)
2015-10-24T11:55:30.259064+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-24T11:55:30.256871+00:00 heroku[web.1]: Process exited with status 1
2015-10-24T11:55:47.462119+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=voidclub.herokuapp.com request_id=d94572b8-4a77-41a3-914a-c2136802c5dc fwd="158.199.193.222" dyno= connect= service= status=503 bytes=
2015-10-24T11:55:48.429317+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=voidclub.herokuapp.com request_id=efc8b77c-88ee-4140-bbce-43b1e4386d7b fwd="158.199.193.222" dyno= connect= service= status=503 bytes=

请问你这个项目的flash是怎么传到ejs里的?

我自己在使用koa2搭建类似你这个项目
目前遇到的问题是不知道怎么把flash和session传到ejs
找了下,有人这么做的
res.locals.flash = req.flash();就可以在ejs里面用flash了
但是ctx.res已经没有locals了~
看你的代码也不知道究竟在哪里重定向
在ejs里引用也应该和koa1不同~

只能实现部分功能

请问,这套源码只能实现注册、登录和发帖功能吗?
觉得我已经把环境配置好了,但是在实际运行时只有注册、登录和发帖功能可以实现(发帖功能还存在一些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.