我正在使用node.js + express和iisnode进行一些实验.我有以下非常简单的应用程序,位于C:\tsapp-deploy\tsappsvr\TestExpress\0.0.0:
app.js:
var express = require('express');
var app = express();
app.use(express.static(__dirname + "/public"));
var port = process.env.PORT || 2709;
app.listen(port, function() {
console.log('Listening on port ' + port);
});
Run Code Online (Sandbox Code Playgroud)
的package.json:
{
"name": "TestExpress",
"version": "0.0.0",
"private": true,
"dependencies": {
"express": "3.x"
}
}
Run Code Online (Sandbox Code Playgroud)
web.config中:
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
公共/ index.html的:
<!doctype html>
<html>
<head>
<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
console.log("READY!");
$("#hello").html("Hello, World!");
});
</script> …Run Code Online (Sandbox Code Playgroud) 我有一个托管在服务器上的网页,比如说http://SVR1/path/index.html,我希望访问托管在另一台服务器上的本地SharePoint网站上的一些列表项,比如说http://SVR2/sites/mySite/.
我正在使用的SharePoint的当前安装(不在我的控制下)不允许部署SharePoint托管的应用程序,也不允许部署托管的托管应用程序,因此我尝试使用SharePoint跨域库从纯粹访问所需的列表项外部HTML5/JS/CSS3页面.作为用户,我对SharePoint网站中的列表具有完全访问权限,因此我认为阅读其项目应该没有问题.
按照此处的示例,我的页面如下:
<!doctype html>
<html>
<head>
<!-- Title -->
<title>Application Template</title>
<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
<script language="javascript" type="text/javascript">
var hostweburl = "http://SVR2/sites/mySite";
var appweburl = "http://SVR1/path";
// Load the required SharePoint libraries
$(document).ready(function () {
$("#renderList").html("Requesting Lists...");
// resources are in URLs in the form:
// web_url/_layouts/15/resource
var scriptbase = hostweburl + "/_layouts/15";
// Load the js files and continue to the successHandler
$.getScript(scriptbase + "/SP.RequestExecutor.js", execCrossDomainRequest);
});
///////////////////////////////////////////////////////
// Function to prepare …Run Code Online (Sandbox Code Playgroud)