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

300
Visualizações
What's the correct configuration of main in angular-cli.json to use express?

I'm trying to configure a express server using Angular 2, in many configuration examples I saw the angular-cli.json being changed in the main configuration pointing to a server.js file.

But when I change it, the application doesn't start on ng serve.

I would have to call the main.ts file inside of the server.js? How?

Ex:

"main": "main.ts"
"main": "server.ts"

My express server is very simple, I used as base the following: https://tableless.com.br/criando-uma-aplicacao-de-chat-simples-com-nodejs-e-socket-io/

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

0

To reiterate from above, you are just going to build your project using the proxy for local development following the - cli proxy docs.

If you do something like

ng serve --host 0.0.0.0 --proxy-config proxy.conf.json

with your proxy.conf.json

{
  "/api": {
  "target": "http://localhost:3000",
  "secure": false
  }
}

For express as your server you will send a route back to the dist/index file with something like -

app.all('/*', function(req, res) {
    res.sendFile( DIST +'/index.html');
});
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