1
CoffeeScript로 작성된 Mongo 및 Mongoose로 Node.js, Express 설치가 있습니다.CoffeeScript로 MongoDB, Mongoose, Node.js 및 Express로 데이터를 표시 할 수 없습니다.
이 코드와 내 컬렉션에 데이터를 저장할 수 있습니다
# new
app.get "/admin/new", (req, res) ->
res.render "admin/new.jade", locals: c: new Content()
# create
app.post "/admin.:format?", (req, res) ->
content = new Content(req.body["content"])
content.save ->
switch req.params.format
when "json"
res.send content.__doc
else
res.redirect "/"
하지만이 코드와 데이터를 표시 할 수 없습니다. 웹 브라우저에는 "Waiting for localhost ..."라고 표시되고 콘솔에는 아무것도 표시되지 않습니다.
# index
app.get "/admin.:format?", (req, res) ->
Content.find().all (contents) ->
switch req.params.format
when "json"
res.send contents.map((c) ->
c.__doc
)
else
res.render "admin/index.jade", locals: contents: contents
감사합니다, 이제 괜찮 workes! 그것을 튜토리얼에서 발견했습니다. 아마도 오래된 것입니다. – Alfred
업데이트와 관련하여 더 많은 문제가 있으니 여기서 또 다른 질문을 던졌습니다 : http://stackoverflow.com/questions/7760838/cannot-post-with-node-js-express-mongodb-mongoose-coffeescript – Alfred