SOCORRO API Nodejs

10/11/2019

8

Galera estou com um problema na API em node. Quando escrevo no terminal o ccomando node app.js, aparece que a API está conectada na porta 3000.
Porém quando acesso no Browser (localhost:3000) aparece a seguinte mensagem:

Cannot GET /

E quando abro o Console do navegador me traz este erro:

localhost/:1 Refused to load the image ''data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABklJREFUeNqsmFtwE1UYx/97Tdqkbei91Gk6IFouYjqjBR3aQTstoM40DD4gOIO++sL4pr45+q7iu+OMyJMD1RcZAXGEBxiUm0JrKfQiDoVeSEmv2WSP3znJJpt0d1Mgpz3d3bPJnt/+v8v5TqX9X89HGMNZ6iGGdGOZP9a11Riz3bddm4n4tz991Pg+SthkDmVmoPhE2Q5bLxwruIakRVHiJnMo+9s/SZMULfTW56PRUiuWB8UKjmCrIqNfva+kYPb5vRiYi5/lnuQrsWIOkzyWWixnzjc/K505VUcgN9Ai5qwo1w7duHknFgzoUDU5Ky+z+YrbuW3sajgcjqmsCAnzSBeFLcn06NJSPBoI+CBJMmQZjw1mmmZsbGzsQ3kFUBEopxewb...GUQklGizqDT1NxcFdnVrlTF6877CtTy7FCACcQV9N6po/cOa9sByZUGFTZ8mfrVDi+u7sLW9eH8Xb3K3lq8aOyvuuD+7Rp2kkLqh+MQrVIZ/xoOo8z69q0nVudkFVa2jc2GNCoDFKogNTIrG3hZqiZxCrZdi7ibNenIyFRKK1iZ+vse5S9R4YPI4Wom015mb23pwqvbinLLuq0TcsmVAsqeyzVln5n37GorAZPiFKm0LykYF9vFba1V9GuSYVPV0kxWWzt8lTKZP6SgvH2+r7+h5Ksh/KVMhHtrSSoSrHX1AmKl9tuUNaYXNL/trFUP6+5cmteGqojUkmmU0TnvrWanVJJwZhp/JgOBEoLJm2WeyoIqoKUkkXnUGlBmCcUrzZKCna2f3+/aRoxrlRfTxAvbw0Ks/EuZ0prt1RkV5E2yTEVJW6pVKK/r7fivfbNZeQ4JhnWFFGbTKbyo67Ap6zo5FDUX/tfgAEAQ3WUFGFdgUwAAAAASUVORK5CYII='' because it violates the following Content Security Policy directive: "default-src ''none''". Note that ''img-src'' was not explicitly set, so ''default-src'' is used as a fallback.

localhost/:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Segue o meu arquivo app.js (da API)

const express = require(''express'');
const mongoose = require(''mongoose'');

const app = express();

// Database
//mongoose.connect(''mongodb://127.0.0.1:27017/user-manage'', {useNewUrlParser: true}, () => console.log(''connected''))
mongoose.connect(''mongodb://127.0.0.1:27017/invest-control'', {useNewUrlParser: true}, () => console.log(''connected''))


//Middleware
app.use(express.urlencoded({ extended: true}))
app.use(express.json())


//controllers

const UserControl = require(''./controllers/UserControl'');
const FundosFiisControl = require(''./controllers/FundosFiisControl'');

//Routes

//user
app.post(''/api/invest/user/create'', UserControl.create);
app.post(''/api/invest/user/update'', UserControl.update); //esta salvando as alteracoes como novo registro- nao esta atualizando
app.get(''/api/invest/user/retrieve'', UserControl.retrieve);

//FundosFiis
app.post(''/api/invest/fiis/create'', FundosFiisControl.create);
app.post(''/api/invest/fiis/update'', FundosFiisControl.update); //esta salvando as alteracoes como novo registro- nao esta atualizando
app.get(''/api/invest/fiis/retrieve'', FundosFiisControl.retrieve);

//listen
app.listen(3000, () => console.log(''Servidor rodando na porta 3000''))
Responder