I have static site with some file below:
index.html
bundle.js
images/some file
some file font, and svg
Problem: I want to build an exe file to serve above file which should run on window.
When install exe file, program will run static site and other component can connect
Please suggest me a for me tool
You may build a node application using express.js web server, then you can compile the code and assets into an exe file using the the pkg module
Using the pkg module you can bundle your node application to run on windows, mac or linux.
To package your statics files with pkg you need to add assets directory to the package.json as mentioned in the document
"pkg": {
"assets": "your-assets-dir/**/*"
}
Please follow these links,
pkg module
expressjs
If you want to make an installer for windows you may use, inno script studio
You can use Electron. It can serve your static site in a chrome window. But as a Desktop app. You can build this for cross platform and you can also make installer file.
Related
I'm new in Angular and NodeJS. I finished all the basic documentation, and now I'm doing tutorials. My question is about the architecture.
Following the angular tutorial, you create a new server:
ng new new-project
That creates a whole server listening to port 4200, you learn and work with angular, learn about directives, etc.
Then you create a server with node, configure routes, etc.
But how these two servers live together?
What do you recommend me to join them?
This is a node server. The angular part are just two files
This is the server created with ng serve. The angular part is so much complicated
Angular project is not a server. Angular is framework to create front-end page/app. Angular-cli command ng serve is used to build application and start a web server on localhost.
When you build your page with angular use angular-cli command ng build --prod to build your page ( more info about ng build command). The build artifacts will be stored in the dist/ directory of your project.
If you want to host angular page with node - copy file from projektFolder/dist to catalog when node can have access to copy files. In node you can use express library to host static files:
app.use('/myangularproject', express.static('myangularproject')) //host static files`
More info about hosted static files in node and express
EDIT
You use Angular CLI to build an angular application. This is an additional tool for working with angular and you do not have to use it.
Angular cli is a command line interface to scaffold and build angular apps using nodejs style (commonJs) modules. Not only it provides you scalable project structure, instead it handles all common tedious tasks for you out of the box
ng serve
ng serve is a tool from angular cli. When you call this command your project is build in memory and serve it via webpack-dev-server. It is used for quick preview and development of the project. If this command is confusing for you then you can use the npm script npm start.
The CLI supports running a live browser reload experience to users by running ng serve. This will compile the application upon file saves and reload the browser with the newly compiled application. This is done by hosting the application in memory and serving it via webpack-dev-server. doc
ng build
ng build compiles the application into an output directory.
Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
When you use command ng new Angular CLI add all necessary files to develop your application. Some of them are used to configure the project e.g tslint.json, tsconfig.json, angular.json ... Do not host these files only result files from the use of the ng build command (/dist directory).
Angular CLI compiles your project into several files (try ng build and look how many files do you have in /dist. You must host all of them. These are static files. You do not need a special server like php files. You can host them using a regular file server. I don't know what you concern use in the node to host static files. If they use express you can use express.static(). More info at the top.
I'm making a command line application with commander, inquirer and nightwatch as top dependencies. The main purpose of the app is for automation and testing.. Is there any way i can make this distributable instead of publishing it as npm package. I want the same functionality as those cli made with python, where it can be setup, and run on a target machine. is this possible? Thank you
Here are two open source projects (PKG and Nexe) that enable you to package your Node.js project into an executable:
https://github.com/zeit/pkg/blob/master/README.md
Or
https://github.com/nexe/nexe/blob/dev/README.md
You can use either one to make an executable of your project.
I have a NodeJS + Express app which I'm using as a Print Server.
I should create an executable from this web application.
So far, I added node-windows and node-mac to make my app run as a service or daemon.
Now what I need is, creating Windows Executable or DMG so my users can execute and start to use my app.
There are some projects like nexe (No support for Exe files) and EncloseJS but I couldn't generate a working EXE file.
What should I use for that?
The guide Standalone Express API Binaries with pkg explains how to make standalone express executables.
I remember hearing from someone that you can simply type in a command to compile a meteor.JS app into a node.JS app, and then deploy it as a node.JS app. Is that correct? Also, does that mean I can build a completely node.JS app by first building it in Meteor, and then using a command to compile it into node? If so, how can I do that?
You can use tool for doing that:
https://github.com/onmodulus/demeteorizer
Tutorial:
http://blog.modulus.io/demeteorizer
I believe you are looking for meteor bundle (See documentation). Meteor bundle constructs a tar.gz file from your meteor application. Once extracted, you should be able to run main.js in the extraction directory and your application built with meteor will run as a standard node application.
For clarification, here are some steps to bundle and run your node application built with meteor.
Within your meteor application directory, run:
meteor bundle appName.tar.gz
Then, unpack the bundle that meteor creates:
tar -xvzf appName.tar.gz
If the proper version of node is installed, you should be able to set your environment variables, and run the application.
export MONGO_URL='mongodb://localhost'
export ROOT_URL='http://myApp.com'
export PORT=5000
And finally, run your application. In the directory that you extracted the tar.gz file to, run:
node main.js
I have the Meteor app setup with such folder structure. I am not able to get the sass or scss file to create the appropriate css on its own and serve it to the client.
What should I do to make sass work as I prefer sass over scss.
Meteor supports less and stylus out of box my issuing meteor add less or meteor add stylus in your project root directory.
there is also a third party package repository (to be rolled into meteor core in the near future) on which you can find alternatives to many requirements.
For example, there is a third party scss package you can add to your project with meteorite add scss.
Now, the meteorite command here belongs to an npm package that interfaces your app to the atmosphere package repository as well as provide some deeper packaging structure to your app.
When you add the scss package, like in a typical meteor application your coffeescript, handlebars,jade,less,scss,javascript etc files will be compiled/bundled at deploy time and at each save afterwards and be placed in a hidden directory. So you will not be seeing your compiled css alongside your scss files, but the css will have been sent to the browser.