Problems with GET Angular 7 request

Asked

Viewed 126 times

0

Good evening guys, I’m trying to create a requisition like get in my Angular application, but it’s popping that error. I couldn’t understand what you mean and none of the possible solutions I tested didn’t work. Could anyone tell me what that mistake means?

Error stack

/home/laura/Documentos/Jobs/Seleções/Even3-Desafio/Desafio-Front-End/node_modules/webpack/schemas/plugins/optimize/OccurrenceOrderChunkIdsPlugin.json: Unexpected end of JSON input
    SyntaxError: /home/laura/Documentos/Jobs/Seleções/Even3-Desafio/Desafio-Front-End/node_modules/webpack/schemas/plugins/optimize/OccurrenceOrderChunkIdsPlugin.json: Unexpected end of JSON input
        at JSON.parse (<anonymous>)
        at Object.Module._extensions..json (internal/modules/cjs/loader.js:708:27)
        at Module.load (internal/modules/cjs/loader.js:599:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
        at Function.Module._load (internal/modules/cjs/loader.js:530:3)
        at Module.require (internal/modules/cjs/loader.js:637:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.<anonymous> (/home/laura/Documentos/Jobs/Seleções/Even3-Desafio/Desafio-Front-End/node_modules/webpack/lib/optimize/OccurrenceChunkOrderPlugin.js:8:16)
        at Module._compile (internal/modules/cjs/loader.js:689:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

app.server.js

axios({
    url: 'http://developer.marvel.com/v1/public/comics',
    method: 'get'
});

app.modulets.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {HttpClientModule} from '@angular/common/http';
import { Subscription } from "rxjs";
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    Subscription
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.componentts.

import { preserveWhitespacesDefault } from '@angular/compiler';
import { Comic } from './comic';
import { Http } from '@angular/http';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  preserveWhitespaces: true
})


export class AppComponent implements OnInit{
  ngOnInit(): void {
    throw new Error("Method not implemented.");
  }
}
  • 1

    Laura, activate F12 in the browser and inspect the network tab to see what the url call is returning. I tested the url directly in the browser and received a 404. On the other hand, I don’t see the method call in your code. Another note: comment on the "throw new Error" of your Appcomponent.ngOnInit.

  • Please add your question the code where you make the request.

  • Victor Henrique believed that the requisition code was the part of the code that uses the library Xios. If that’s not the case, then I believe I don’t have that code.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.