S
S
Speakermen2021-10-05 10:20:16
Angular
Speakermen, 2021-10-05 10:20:16

How to "deploy" on heroku nestjs + angular?

Good day, how to deploy first frontend then backend to configure cors? Or is it possible to somehow make the frontend and backend lie together.? I do not use Docker, the processor does not support virtualization (((I first run localhost: 3000 then localhost: 8000 in vs code on the local server

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lssssssssssl, 2021-10-05
@Speakermen

  1. Doing ng build in an angular project
  2. Put the build result (dist folder) in your nestjs project in the client folder (Or any other name of your preference in the project root, except for the dist folder, if it is updated after each nestjs build)
  3. Set up nestjs to work with static https://docs.nestjs.com/recipes/serve-static
  4. Do a project build on nestjs
  5. In package.json, check for the presence of the command "start:prod": "node dist/main"
  6. Run the command, see if everything works correctly (Is the static visible)
  7. Deploy the resulting nestjs application like a normal nestjs application. You can already forget about Angular, since it has turned into a simple js code in the client folder. Consider that it has become a full part of the nestjs code

Of course, you don’t need to add the client folder to .gitignore or any other ignore.
There will be no problems with corso in this case

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question