Express requirejs没有正确加载
这可能是初学者的错误。我得到这个错误Express requirejs没有正确加载,express,requirejs,Express,Requirejs,这可能是初学者的错误。我得到这个错误 “未捕获的SyntaxError:意外标记极端错误,我的express根目录配置不正确 app.use('/' ,function(req,res,next) { res.sendfile("index.html", {'root':"../"}); }); <!doctype html> <html lang="en"> <head> <meta charset="utf-8"&g
“未捕获的SyntaxError:意外标记极端错误,我的express根目录配置不正确
app.use('/' ,function(req,res,next) {
res.sendfile("index.html", {'root':"../"});
});
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title> blabvla </title>
</head>
<body>
<h1> BLABLALBLAL </h1>
<section id="app">
</section>
<footer> </footer>
<script data-main="application/main" src="bower_components/requirejs/require.js"></script>
</body>
</html>
/*global require*/
'use strict';
// Require.js allows us to configure shortcut alias
require.config({
// The shim config allows us to configure dependencies for
// scripts that do not call define() to register a module
shim: {
underscore: {
exports: '_'
},
backbone: {
deps: [
'underscore',
'jquery'
],
exports: 'Backbone'
}
},
paths: {
jquery: '../bower_components/jquery/dist/jquery',
underscore: '../bower_components/underscore/underscore',
backbone: '../bower_components/backbone/backbone',
text: '../bower_components/requirejs-text/text'
}
});
require([
'backbone',
'views/app',
'routers/router'
], function (Backbone, AppView, Router) {
/*jshint nonew:false*/
// Initialize routing and start Backbone.history()
new Router();
Backbone.history.start();
console.log("TEST !!!");
// Initialize the application view
var appview = new AppView();
appview.render();
});