Haha, it's back.
When you've developed a node. JS project, you need to pack and distribute it.
Well, that's what Jxcore did!
Well, maybe you'd like to install
1.
Curl http://jxcore.com/xil.sh | bash
It turned out to be dead.
2.
Curl http://jxcore.com/xil.sh | sudo bash
Or dead?
Why?
Well...
Of course, the world article a big copy, only a pity that you will not copy. Ha ha haha
All right, let me tell you something.
1. Download the source code
git clone https://github.com/jxcore/jxcore.git
2. Compiling
./configure
Make
3. Installation
Vim/etc/profile
Export path= $PATH:/root/jxcore #这里可得是你的实际路径哦
Source/etc/profile
4.demo
Server.js
var express = require (' Express ');
var app = Express ();
App.use (express.static (' public '));
App.get ('/index.htm ', function (req, res) {
Res.sendfile (__dirname + "/" + "index.htm");
});
App.get ('/process_get ', function (req, res) {
var response = {
"First_Name": Req.query.first_name,
"Last_Name": Req.query.last_name
};
Console.log (response);
Res.end (json.stringify (response));
});
var server = App.listen (8080, function () {
var host = Server.address (). Address;
var port = server.address (). Port;
Console.log ("Application Server run at http://%s:%s", host, Port)
});
Index.htm
<body>
<form action= "Http://192.168.40.131:8080/process_get" method= "Get" >
First Name: <input type= "text" name= "first_name" > <br>
Last Name: <input type= "text" name= "last_name" >
<input type= "Submit" value= "Submit" >
</form>
</body>
Pack it up.
JX Package Server.js Server
Processing the folder.
JXP project file (SERVER.JXP) is ready.
Preparing the JX file.
Compiling Server 1.0
adding script Server.js
Adding asset index.htm
[OK] Compiled file is ready (SERVER.JX)
Ls
index.htm server.js SERVER.JX Server.jxp
Now with the package file SERVER.JX
Run the package.
JX SERVER.JX
Application Server run at http://0.0.0.0:8080
Check out the service results.
Finally:
See, this is called a package running node. js. This thing is invented in the jar package, the progress is to be able to run directly.
How, how do you feel ah.
By the right, forget, tell, the foreigner invented the thing, does not seem to support Chinese AH.
Foreigners!
Feelings! We forgave him.
node. JS Project Packaging Jxcore