Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
Swagger ui is not loading swagger api json

I have made api documention with the help of swagger-editor. Now I want see it graphically with the help of swagger-ui. I have deployed my json here https://powerful-escarpment-92284.herokuapp.com/swagger.json

Now When I am trying to access it then I am getting an error

Failed to load spec.

enter image description here

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I solved this by setting this header in the response of swagger.json file.

app.get('/:file(*)', function(req, res, next){
    var file = req.params.file, path = __dirname + '/' + file;

    console.log('.');
    res.header('Access-Control-Allow-Origin', '*');

    res.download(path);
});
over 4 years ago · Santiago Trujillo Relatório

0

I was getting this error in a c# project, due to a problem with a controller I added. I could get more information by trying to browse to the swagger.json It turned out I was missing the routing attribute on a controller action.

over 4 years ago · Santiago Trujillo Relatório

0

After many exercises for me apparently, it helped just to serve a file with flask server [How to serve static files in Flask. and (important) add "?" to the end of the url, i.e. http://127.0.0.1/js/swagger.json?

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda