Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

No response is received from the request #24

@jcjp

Description

@jcjp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions