Skip to content

Instantly share code, notes, and snippets.

@Juraci
Created November 14, 2016 16:20
Show Gist options
  • Save Juraci/ef5b815302663386fe9fbed18e7a1229 to your computer and use it in GitHub Desktop.
Save Juraci/ef5b815302663386fe9fbed18e7a1229 to your computer and use it in GitHub Desktop.
After transpiling with babel-preset-node6
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _express = require('express');
var _express2 = _interopRequireDefault(_express);
var _bodyParser = require('body-parser');
var _bodyParser2 = _interopRequireDefault(_bodyParser);
var _goals = require('../controllers/goals');
var _goals2 = _interopRequireDefault(_goals);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const router = _express2.default.Router();
const jsonParser = _bodyParser2.default.json();
exports.default = datasource => {
const Goal = datasource.models.Goal;
const goalsController = new _goals2.default(Goal);
router.route('/').get((req, res) => {
goalsController.findAll().then(result => {
res.status(result.status).json(result.data);
});
});
return router;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment