Comments (3)
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: StringBook = 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.
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: StringBook = 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/bookIt 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.
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)
- MissingSchemaError instead of 404 HOT 3
- Validation errors on PUT cause crash HOT 1
- default transformer? HOT 1
- How can I protect UPDATE, DELETE, INSERT endpoints with authentication? HOT 3
- Posting multi level schemas HOT 4
- Populate Nested refernces HOT 2
- Error With Status of 0 HOT 3
- app.del deprecated HOT 1
- Add option to use raw MongoDB queries in the query string HOT 2
- Default query transformer? HOT 2
- Error handling for POST HOT 5
- Mongoose: Remove hook not triggered when removing HOT 1
- NPM version not latest HOT 1
- Can't POST new doc HOT 1
- What is the license of this code? HOT 4
- Custom ResultStream issue HOT 3
- How do you use transformers ? HOT 1
- Find on Schema only ever returns 1 record HOT 10
- Restify? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mers.