naptime
v0.1.1
Published
rest api express middleware for mongoose
Downloads
2
Readme
#naptime
rest api express middleware for mongoose
npm install --save naptime
#Usage
Define a mongoose schema, and use naptime middleware to provide rest endpoints for that mongoose model. The id is the mongo id returned from the object._id.
import naptime from 'naptime';
const TEST_MODEL = 'Test';
mongoose.model(TEST_MODEL, new mongoose.Schema({
foo: {
type: String
}
}));
const app = express();
app.use('/test', naptime(TEST_MODEL));
// These endpoints will now work
// GET /test
// GET /test/:id
// POST /test
// PUT /test/:id
// DELETE /test/:id