1

I have created an application in node js with express framework. And need to deploy it on production server.

But don't want to deploy whole project on the server because security purpose. I want to create minified dist directory and deploy it on the production.

Is their any approach available to achieve this.

Parth Agrawal
  • 63
  • 2
  • 10

2 Answers2

0

You have to upload express server and related route files on server. As express run directly by node.js. you don't have to minify it.

By default express block access to other files which is not used for server.

You can allow access to other files like index.html based on link here

Dipten
  • 1,031
  • 8
  • 16
-1

I guess what you're looking for a packager. You can try Parcel JS to bundle your project.

Srinath Kamath
  • 542
  • 1
  • 6
  • 17
  • 1
    Look at minify & uglify. https://www.npmjs.com/package/uglify-js https://www.npmjs.com/package/node-minify – Daniil Loban Dec 16 '20 at 05:29
  • Yes, those are useful as well. However, I find parcel a bit easier to use and so is its bundling. – Srinath Kamath Dec 16 '20 at 05:33
  • Thank you, I will this packages – Parth Agrawal Dec 16 '20 at 12:14
  • @Srinath Nilatech and Daniil Loban Hi, Is it possible to build the folder for the REST API's built on node.js – Parth Agrawal Dec 17 '20 at 13:23
  • I dont think so. You can only minify but not build like we do in angular applications for example. You will have to upload the minified files to your git account your cloud provider provides and install the package.json on the server. that's how we deploy the nodejs server. – Srinath Kamath Dec 18 '20 at 08:12