我有一个 node.js 应用程序,在访问 localhost/user/signup 时会加载一个注册表单:
html
head
script(type='text/javascript',src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
script(type='text/javascript',src='javascripts/validator.js')
script(type='text/javascript',src='javascripts/signupValidation.js')
body
p(id='error', style='display:none;')#{error}
form(id='signup',method='post',action='/signup')
label(for='firstname') Firstname
input(type='text', name='firstname')
label(for='lastname') Lastname
input(type='text', name='lastname')
label Username
input(type='text', name='username')
label Password
input(type='password', name='password')
label Password again
input(type='password', name='password2')
label Email
input(type='email', name='email')
input(type='submit',value='Sign up', onclick="")
但是当我访问该页面时,服务器控制台记录了获取 JavaScript 文件的 404 错误,它工作正常,直到我将要加载的注册页面从以下位置更改localhost/signup
为localhost/user/signup
:
app.get('/signup',user.signupForm);
到:
app.get('/user/signup',user.signupForm);