Giter Site home page Giter Site logo

Post Data Not Saving about mers HOT 3 CLOSED

jspears avatar jspears commented on August 25, 2024
Post Data Not Saving

from mers.

Comments (3)

jspears avatar jspears commented on August 25, 2024

It looks right, I think I may have had a bad merge. I will take a look
and let you know.

On Wed, Dec 11, 2013 at 12:44 AM, giodamelio [email protected]:

I have a simple mers app.

express = require "express"
mongoose = require "mongoose"
mers = require "mers"

app = express()

Schema = mongoose.Schema

BookSchema = new Schema
title: String
author: String

Book = mongoose.model "Book", BookSchema

app.use "/rest", mers(
uri: "mongodb://localhost/library"
mongoose: mongoose
).rest()

console.log app.routes

app.listen 3141

When I post data with curl.

curl -X POST -d '{"title": "Ready Player One","author": "Ernest Cline"}' -H "Content-Type: application/json" http://localhost:3141/rest/book

It creates an empty object.

{
"payload": {
"__v": 0,
"_id": "52a7fb5667c42afe7e000007"
},
"status": 0
}

The same thing happens with PUT. Am I doing something wrong?


Reply to this email directly or view it on GitHubhttps://github.com//issues/24
.

from mers.

giodamelio avatar giodamelio commented on August 25, 2024

Thanks

On Wed, Dec 11, 2013 at 8:11 PM, Justin [email protected] wrote:

It looks right, I think I may have had a bad merge. I will take a look
and let you know.

On Wed, Dec 11, 2013 at 12:44 AM, giodamelio [email protected]:

I have a simple mers app.

express = require "express"
mongoose = require "mongoose"
mers = require "mers"

app = express()

Schema = mongoose.Schema

BookSchema = new Schema
title: String
author: String

Book = mongoose.model "Book", BookSchema

app.use "/rest", mers(
uri: "mongodb://localhost/library"
mongoose: mongoose
).rest()

console.log app.routes

app.listen 3141

When I post data with curl.

curl -X POST -d '{"title": "Ready Player One","author": "Ernest Cline"}'
-H "Content-Type: application/json" http://localhost:3141/rest/book

It creates an empty object.

{
"payload": {
"__v": 0,
"_id": "52a7fb5667c42afe7e000007"
},
"status": 0
}

The same thing happens with PUT. Am I doing something wrong?


Reply to this email directly or view it on GitHub<
https://github.com/jspears/mers/issues/24>
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-30388128
.

Gio d'Amelio
[email protected]

from mers.

jspears avatar jspears commented on August 25, 2024

app.use "/rest", mers(
uri: "mongodb://localhost/library"
mongoose: mongoose
).rest()

I do not know if this would work. its an or, use uri or mongoose. If you pass in a mongoose object or connection you will need to call connect

from mers.

Related Issues (20)

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.