Já realizei a sugestão de retirar os comentários do Express mas o aviso persiste e não consigo realizar a consulta...
` dentro do principal.html `
<a id="botao-frase" class="btn-floating btn-large waves-effect waves-light blue">
<i class="material-icons">shuffle</i>
</a>
` referências no principal html `
</div>
<script src="js/jquery.js"></script>
<script src="js/logicaJogo.js"></script>
<script src="js/placar.js"></script>
<script src="js/main.js"></script>
<script src="js/frase.js"></script>
</body>
` funcoes no main.js `
$('#botao-frase').click(function() {
fraseAleatoria();
});
` funcoes no frase.js `
function fraseAleatoria() {
$.get("http://localhost:3000/frases", trocaFraseAleatoria);
}
function trocaFraseAleatoria(data) {
var frase = $(".frase");
var numeroAleatorio = Math.floor(Math.random() * data.length);
frase.text(html(data[numeroAleatorio].text));
autalizaFrase();
atualizaTempoInicial(data[numeroAleatorio].tempo);
}
` Status do Server:
consign v0.1.2 Initialized in app
- .\api\frases.js
- .\api\placar.js
- .\routes\frases.js
- .\routes\placar.js
Banco data.db pronto para uso
Servidor iniciado
Resposta do Chrome ao GET:
principal.html:1 Access to XMLHttpRequest at 'http://localhost:3000/frases' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.`
EDIT: Opa, subi o servidor a partir de outro projeto... por isso não funcionou...