Hi,
I have a site which uses a library with a static file named server.js.
Node.js seems to be treating this as a file which needs to be interpreted
on the server side rather than a static file. Hence, I get an error: 'Uncaught
SyntaxError: Unexpected token < '
Is there any way around this?
I created a small example of the problem with code snippets below.
Thanks in advance,
Yishay
Here's my server code:
====
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes');
var app = module.exports = express.createServer();
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
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());});
// Routes
app.get('/', routes.index);
app.listen(process.env.port || 3000);
console.log("Express server listening on port %d in %s mode",
app.address().port, app.settings.env);
====
My index.html (under public/index.html)
======
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script src="Server.js"></script>
hello
</body></html>
=======
And Server.js which is under the same dir
=======
alert('serving');
=======
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en