Create a self-signed HTTPS server with node. js
Create your own CA agency
Create a server-side certificate
Create a client certificate
Package the Certificate
Create your own CA agency
Generate a private key for a CA
OpenSSL genrsa-out ca-key.pem-des 1024
time when a Web page or URL address is no longer cached by the browser, and once the time has passed, the browser should contact the original server. The expiration time for this setting is 1 years.Exports. Expires = { /^ (gif|png|jpg|js|css) $/IG, 60*60*24*365= { /css|js| html/= { "index.html"};Enumerates the types of various resources, which can be
that you receive it accurately. ThroughChannelwe can specify which pages or which users canreceived from thisChannelthe message that was pushed out. node. js Web Real-time messaging backend server Push technology solution Let me show you how to useGoeasythe steps:1.you need toGoeasyOfficial online registration of an account,and create an app, the system will def
More and more projects need to use real-time message push and receive, how to use node. js to achieve the most convenient? I recommend that you use the Goeasy, it is a third-party push service platform, using its API can easily take care of real-time push!Browser compatibility: Goeasy push supports websocket and polling two connections to support all versions of IE6 and above, while also supporting other br
StopAll--pidfile $PID Restartall) Forever Restartall--pidfile $PID Reload|restart) Forever Restart-L $LOG/forever.log-o $LOG/forever_out.log-e $LOG/forever_err.log--pidfile $PID-a $DEAMONlist) Forever list*) echo"Usage:/etc.init.d/node {start|stop|restart|reload|stopall|restartall|list}"Exit1Esacexit0The above code is my local virtual machine configuration, according to the actual situation to modify the relevant parameters, mainly Deamon path parame
); Xhr.send (str); }node. JS:varHTTP = require (' http ');varQueryString = Require (' querystring '));varurl = require (' URL '));varUtil = require (' util ')); Http.createserver (function(req, res) {//Staging request body Information varBODY = ""; //Request LinkConsole.log (Req.url); //whenever the request body data is received, it is added to the postReq.on (' Data ',function(chunk) {body+ = chunk;//be sure to use + = if body=chunk, because th
How do I use node. js NPM after it has been installed http-server globally? I created the inde.html in its installation directory, the browser localhost:8080 can access, then my project needs to be placed in its installation directory? Or do I need to configure something under my project or use a command to start it? I open cmd in my project directory run Http-
, Json.parse to convert the JSON text to an object varRetval=json.stringify (arr); Resp.end (retval);//Response Object End Response});//Server starts operation listening PortServer.listen ("localhost",function() {Console.log ("Server started operation, listening on port 3000 ...");});Page code:DOCTYPE HTML>HTMLLang= "Utf-8">Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/>Head> titl
, Json.parse to convert the JSON text to an object varRetval=json.stringify (arr); Resp.end (retval);//Response Object End Response});//Server starts operation listening PortServer.listen ("localhost",function() {Console.log ("Server started operation, listening on port 3000 ...");});Page ANGULARJS Code:DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">H
Original address: http://my.oschina.net/yushulx/blog/309413Catalogue [-]
Installation
Service side
Client
Reference
Installation?
1
npminstallws
Service sideServer.js?
12345678
var WebSocketServer=require(‘ws‘).Server,wss=newWebSocketServer({port:8080});wss.on(‘connection‘,function(ws){ws.on(‘message‘,function(message){console.log(‘received:%s‘,message);});ws.send(‘something‘);
than the HTTP protocol.
OpenSSL generates a certificate fileAs long as the Git client is installed, there will be OpenSSLDetect if OpenSSL is installedOpenSSL version-aNext, start generating the certificate:#1#2, generate CSR certificate signature via private key -new-key Privatekey.pem- Out certrequest.csr#3-req- in Certrequest.csr-signkey privatekey.pem-out Certificate.pemAfter executing the third command you will see: Signature ok表示生成成功,最终看到如下三个文件
PRIVATEKEY.PEM: Private key
1.Node is often used to build servers, and the following code creates a server.var http = require (' http '); var server = http.createserver (); Server.on (' require ',function(req,res) { Res.writehead (200,{' content-type ': ' Text/plain '); Res.end (' hello,world\n '); }) Server.listen; Console.log (' server running at Http://localhost:3000/');Use the Cre
Client-clients, commonly referred to as browsers, can request data from the server via the HTTP protocol.
Server -a server-side, generally referred to as the Web servers, can receive client requests and send response data to the client.
Business-service layer, which handles applications through Web servers, such as interacting with databases, logical opera
Json-server makes it extremely easy-to-Setup robust JSON APIs to use for demos and proof of concepts. John walks through the process of using pre-built JSON files for a server and how to generate larger datasets using Lo Dash and Faker.Install:NPM install-g Json-serverCreate A JSON file:{ "people": [ { "id": 0, "name": "John" } ]}Run:Json-
Nodejs is actually a JavaScript execution environment.To create a new file Server.js, enter the following code:var http = require (' http 'var server = Http.createserver (function(req, res) { Res.writehead ($, {' Content-type ': ' Text/plain '}); Res.end (' Hello world\n ');}); Server.listen (1337, ' 127.0.0.1 '); Console.log (' Server running at http://127.0.0.1:1337 ');The console goes to the direct
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.