Please provide us with the following information:
This issue is for a: (mark with an x)
- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
I followed the steps up until Part 4
Any log messages given by the failure
Failed to load resource: net::ERR_EMPTY_RESPONSE
"Http failure response for (unknown url): 0 Unknown Error"
name
:
"HttpErrorResponse"
Expected/desired behavior
Once I click on the submit button it should show the list or result
OS and Version?
Windows 10
Versions
Mention any other details that might be useful
Here is my method to get the data on the service:
getData() {
return this.http.get<Array>(${api}/heroes)
}
Here is on the component.ts file:
onSubmit() {
return this.adminService.getData().subscribe(data => {
this.data = data;
console.log('Inside subscribe!');
console.log(this.data);
});
}
Here is on what is on my routes.js:
const express = require('express');
const router = express.Router();
const heroService = require('./hero.service');
router.get('/heroes', (req, res) => {
heroService.getHeroes(req, res);
});
module.exports = router;
Here is the getHeroes from heroService:
const Hero = require('./hero.model');
require('./mongo').connect();
function getHeroes(req, res) {
const docquery = Hero.find({});
docquery
.exec()
.then(heroes => {
res.status(200).json(heroes);
console.log('OneKB data has been taken!');
})
.catch(error => {
res.status(500).send(error);
return;
});
}
module.exports = {
getHeroes
};
Thanks! We'll be in touch soon.