Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 12, 2022 06:07 pm GMT

Local build and run nestjs application

Update nx

The current version of nx contains bugs, need update it

npx nx migrate @nrwl/workspace

endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ npx nx migrate @nrwl/workspaceFetching meta data about packages.It may take a few minutes.Fetching @nrwl/workspace@latestFetching prettier@^2.5.1Fetching @nrwl/[email protected] @nrwl/[email protected] @nrwl/[email protected] @nrwl/[email protected] @nrwl/[email protected] @nrwl/[email protected] @nrwl/[email protected] @nrwl/[email protected] [email protected]>  NX  The migrate command has run successfully.- package.json has been updated- migrations.json has been generated>  NX  Next steps:- Make sure package.json changes make sense and then run 'npm install'- Run 'nx migrate --run-migrations'- To learn more go to https://nx.dev/using-nx/updating-nx- You may run "nx connect-to-nx-cloud" to get faster builds, GitHub integration, and more. Check out https://nx.app

npm i

endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ npm iadded 1 package, removed 103 packages, changed 7 packages, and audited 746 packages in 4s76 packages are looking for funding  run `npm fund` for detailsfound 0 vulnerabilities

npm run nx -- migrate --run-migrations

endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ npm run nx -- migrate --run-migrations> [email protected] nx> nx "migrate" "--run-migrations">  NX  Running 'npm install' to make sure necessary packages are installedup to date, audited 746 packages in 3s76 packages are looking for funding  run `npm fund` for detailsfound 0 vulnerabilities>  NX  Running migrations from 'migrations.json'Running migration set-default-base-if-not-setSuccessfully finished set-default-base-if-not-set---------------------------------------------------------Running migration 13-0-0-config-locationsSuccessfully finished 13-0-0-config-locations---------------------------------------------------------Running migration set-parallel-defaultSuccessfully finished set-parallel-default---------------------------------------------------------Running migration 13-3-0-tsc-locationSuccessfully finished 13-3-0-tsc-location---------------------------------------------------------Running migration 13-6-0-remove-old-task-runner-optionsSuccessfully finished 13-6-0-remove-old-task-runner-options--------------------------------------------------------->  NX  Successfully finished running migrations from 'migrations.json'

Build sources

npm run nx -- build server

endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ npm run nx -- build server> [email protected] nx> nx "build" "server"> nx run server:buildchunk (runtime: main) main.js (main) 2.76 KiB [entry] [rendered]webpack compiled successfully (ba0f882f8a8c0d5f)  >  NX   Successfully ran target build for project server (4s)

Start built application

node ./dist/apps/server/main.js

endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ node ./dist/apps/server/main.js[Nest] 1439017  - 02/12/2022, 9:14:11 PM     LOG [NestFactory] Starting Nest application...[Nest] 1439017  - 02/12/2022, 9:14:11 PM     LOG [InstanceLoader] AppModule dependencies initialized +31ms[Nest] 1439017  - 02/12/2022, 9:14:11 PM     LOG [RoutesResolver] AppController {/api}: +6ms[Nest] 1439017  - 02/12/2022, 9:14:11 PM     LOG [RouterExplorer] Mapped {/api, GET} route +3ms[Nest] 1439017  - 02/12/2022, 9:14:11 PM     LOG [NestApplication] Nest application successfully started +3ms[Nest] 1439017  - 02/12/2022, 9:14:11 PM     LOG  Application is running on: http://localhost:3333/api

Check applications

curl http://localhost:3333/api

endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ curl http://localhost:3333/api{"message":"Welcome to server!"}endy@endy-virtual-machine:~/Projects/current/kaufman-bot$

Original Link: https://dev.to/endykaufman/local-build-and-run-nestjs-application-56m4

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To