mint-api-news
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -11,7 +11,6 @@ 'use strict'; | ||
title: { type: String, required: true, unique: true }, | ||
description: [], | ||
image: String, | ||
description: [], | ||
url: { type: String, required: true }, | ||
source: { type: String, required: true }, | ||
link: { type: String, required: true }, | ||
status: { type: Boolean, default: true }, | ||
createdAt: { type: Date, default: Date.now }, | ||
@@ -18,0 +17,0 @@ updatedAt: { type: Date, default: Date.now } |
@@ -11,38 +11,46 @@ 'use strict'; | ||
var _newsController = require('./controllers/newsController'); | ||
var _mongoose = require('mongoose'); | ||
var _newsController2 = _interopRequireDefault(_newsController); | ||
var _mongoose2 = _interopRequireDefault(_mongoose); | ||
var _expressGraphql = require('express-graphql'); | ||
var _expressGraphql2 = _interopRequireDefault(_expressGraphql); | ||
var _newsSchema = require('./graphql/schema/newsSchema'); | ||
var _newsSchema2 = _interopRequireDefault(_newsSchema); | ||
var _newsModel = require('./models/newsModel'); | ||
var _newsModel2 = _interopRequireDefault(_newsModel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var router = _express2.default.Router({ mergeParams: true }); | ||
_mongoose2.default.Promise = global.Promise; | ||
router.get('/news', function (req, res) { | ||
_newsController2.default.list(req.params).then(function (data) { | ||
res.json({ | ||
status: true, | ||
data: data | ||
}); | ||
}).catch(function (error) { | ||
res.json({ | ||
status: false, | ||
error: error | ||
}); | ||
}); | ||
}); | ||
var router = _express2.default.Router(); | ||
router.post('/news', function (req, res) { | ||
_newsController2.default.save(req.body).then(function (data) { | ||
res.json({ | ||
status: true, | ||
data: data | ||
}); | ||
}).catch(function (error) { | ||
res.json({ | ||
status: false, | ||
error: error | ||
}); | ||
}); | ||
}); | ||
router.get('/news', (0, _expressGraphql2.default)(function () { | ||
return { | ||
schema: _newsSchema2.default | ||
}; | ||
})); | ||
// router.post('/news', (req, res) => { | ||
// NewsController.save(req.body) | ||
// .then((data) => { | ||
// res.json({ | ||
// status: true, | ||
// data, | ||
// }) | ||
// }) | ||
// .catch((error) => { | ||
// res.json({ | ||
// status: false, | ||
// error, | ||
// }) | ||
// }) | ||
// }) | ||
exports.default = router; |
{ | ||
"name": "mint-api-news", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"main": "./dist/routes.js", | ||
@@ -26,2 +26,4 @@ "scripts": { | ||
"express": "^4.15.3", | ||
"express-graphql": "^0.6.11", | ||
"graphql": "^0.12.3", | ||
"lodash": "^4.17.4", | ||
@@ -28,0 +30,0 @@ "mongoose": "^4.11.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10612
8
251
9
+ Addedexpress-graphql@^0.6.11
+ Addedgraphql@^0.12.3
+ Addedexpress-graphql@0.6.12(transitive)
+ Addedgraphql@0.12.3(transitive)
+ Addedhttp-errors@1.8.1(transitive)
+ Addediterall@1.1.3(transitive)
+ Addedstatuses@1.5.0(transitive)