我愿在我的网站上增加一些实时功能,包括节点和袖珍,但不必处理页码要求/答复。 曼 谷 我拥有正常的双倍功能,哪里可以提供指数。
感谢!
我愿在我的网站上增加一些实时功能,包括节点和袖珍,但不必处理页码要求/答复。 曼 谷 我拥有正常的双倍功能,哪里可以提供指数。
感谢!
你可以使用快递框架。 将你的档案置于公共文件夹、你的所有风格、javascript文档和其他超文本文件之下。 你们只需要表明一个切入点,以便提供客户指数。
var fs = require("fs");
var express = require("express");
app = express.createServer();
app.use(express.static(__dirname + /public ));
app.get( / , function(req, res) {
fs.readFile(__dirname + /public/index.html , utf8 , function(err, text){
res.send(text);
});
});
app.listen(3000);
如果你只想提供静态档案,则使用明示的方式非常简单。
备注文件只需要以下编码线:
var express = require( express );
var app = express.createServer(
express.static(__dirname + /public )
);
app.listen(3000);
您的问世、 c和 j,是你申请的根基。 因此,一个典型的切身之处是:
app.js
/public
index.html
reset.html
...
...
/css
main.css
reset.css
...
...
/js
header.js
util.js
...
...
我采用了一种略有不同的做法,结果相同:
var express = require( express );
var app = express();
app.use(express.static(__dirname + /public ));
app.listen(process.env.PORT || 3000);
I am building a web application using NodeJS splitting the application into a back-end to handle database queries with MongoDB and a front end via a node based webserver that uses interactjs with ...
I have a working Express.js-based app running on Node.js. Now, I want to wrap it up with pm2. To do that, I ve defined ecosystem.json: { "apps": [ { "env": {...
I need to read a large JSON file (around 630MB) in Nodejs and insert each object to MongoDB. I ve read the answer here:Parse large JSON file in Nodejs. However, answers there are handling the JSON ...
I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.
I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...
I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...
Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?
In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...