I m trying to deliver a static html file which uses jquery and other libraries and i want to know how to do his with express.
这里的我手法(明示服务器档案)
var express = require( express )
, routes = require( ./routes )
var app = module.exports = express.createServer();
app.configure(function(){
app.set( views , __dirname + /views );
app.use(express.static(__dirname + /public ));
});
app.configure( development , function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack:
true }));
});
app.configure( production , function(){
app.use(express.errorHandler());
});
app.register( .html , require( jade ));
app.get( / , function(req, res) {
res.render( index.html );
});
app.listen(3000);
页: 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel= stylesheet type= text/css href= theme.css />
<link rel= stylesheet type= text/css href= fullcalendar.css />
<link rel= stylesheet type= text/css href= fullcalendar.print.css
media= print />
<script type= text/javascript src= jquery-ui-1.8.11.custom.min.js ></
script>
<script type= text/javascript src= jquery-1.5.2.min.js ></script>
<script type= text/javascript src= fullcalendar.min.js ></script>
<script type= text/javascript >
$(document).ready(function() {
$( #calendar ).fullCalendar({
theme: true,
header: {
left: prev,next today ,
center: title ,
right: month
},
editable: true,
events: { url : http://localhost:5555/ },
firstDay : 1,
weekends : true
});
});
</script>
<style type= text/css >
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida
Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id= calendar ></div>
</body>
</html>
以及当我操作服务器和把我的浏览器放在服务器上时,就会出现环礁错误。
Error: D:Workspace
odejs estmy-server/views/index.html:12
10| <script type= text/javascript >
11|
> 12| $(document).ready(function() {
13|
14| $( #calendar ).fullCalendar({
15| theme: true,
unexpected token "indent"
at Object.parseExpr (D:Workspace
odejs estmy-server
ode_modulesjadelibparser.js:228:15)
at Object.parse (D:Workspace
odejs estmy-server
ode_modules
jadelibparser.js:129:25)
at parse (D:Workspace
odejs estmy-server
ode_modulesjadelib
jade.js:101:62)
at Object.compile (D:Workspace
odejs estmy-server
ode_modules
jadelibjade.js:148:9)
I did initial googling, but coudn t figure much.. can somone let know wht s happening. Thanks