resource: net :: ERR_CONNECTION_REFUSED - Ionic Version 3.x

-1

This is my first post here, and I hope you can help me.

I'm new to application development and I'm starting to develop an Ionic application for my TCC, which is intended to bring news from the IFSP-VOTUPORANGA official website to the application to bring the news closer to the students, employees and management. For ethical reasons I do not have direct access to the official database, and I will have access to a web service that will simply pull the data from the database, convert it to JSON and I will have to read the JSON and display it on the screen. I got a "copy" with no sensitive data from the database and had to find the table responsible for the news displayed and try to do the part myself that converts to JSON and to test if it really worked I needed to test in place and am having the following error: / p>

Andgoodcodesrelatedtothepagesneededtodothis.It'sworthmentioningthatItestedandpresenteda"pulled" version of an API called themoviedb to "pre-banca" to show that my idea was possible and to have permission to continue the search.

Follow the codes: noticia.ts - > is an ionic provider

home.ts->isthetypscriptpagefromwhereitshouldbeinsertedifalldataiscorrect

home.html->isthepagewhereitisdisplayed

I hope you can help me!

    
asked by anonymous 24.08.2018 / 01:31

1 answer

0

Apparently your backend is denying this request because it is running on localhost. You need to enable CORS at the header of your call in php:

  

link

Basically you will enter the command:

header("Access-Control-Allow-Origin: *");

In the header of your backend so that it will accept certain calls from a different link.

    
24.08.2018 / 05:05