我目前正在使用Node.js
和Express.js
构建一个web应用程序。Node.js用户名和密码认证
我正在寻找一种方式来与我的主要app.js
文件中的用户名和密码,在http://www.domain.com/login
听了一post
请求一个简单的服务器端认证:
app.js
app.post('/login', function(req, res) {
// some server-side code for a username and password
}
在客户端,我有一个带有用户名和密码的简单登录表单。这种形式将发布到服务器:
的index.html
<form method="post" action="/login">
<input type="text" id="user" name="user" />
<input type="password" id="pass" name="pass" />
<button type="submit">Login</button>
</form>
我期待实现这一不使用任何ExpressJS
插件。
编辑:所以我的问题是,如何在ExpressJS和NodeJS中实现简单的用户名和密码认证?
你能更具体吗?你实际上没有问过问题。 – JohnnyHK
http://devsmash.com/blog/password-authentication-with-mongoose-and-bcrypt – chovy