html - 不能 GET /Login 或更高版本不能 POST /Login
问题描述
请帮助,是使用express创建和提交一个html表单,但错误是Cannot GET /Login或更高版本的Cannot POST /Login
<form name="myForm" onsubmit="return validateForm()" method="POST" action="/login">
Email <br><input type="email"name="email" required><br>
Password <br><input type="Password"name="password" required><br>
<input type="submit" value="Login">
<input type="reset"><br>
New to Soft Mak Finder? <a href="/Register">Register</a>
</form>
无法使用快递发布/错误
这是我的js代码:
const path = require('path')
const express = require('express');
const app = express(); // to link html files from any other section
const bodyParser = require('body-parser');
const bcrypt=require('bcrypt-nodejs');
app.use(express.static(__dirname+"/public"));
app.get('/',(req, res)=>{
res.sendFile(path.join(__dirname+"/views/index.html"));
})
app.get("/about",(req,res)=>{
res.sendFile(path.join(__dirname+"/views/about.html"));
});
app.get("/notice",(req,res)=>{
res.sendFile(path.join(__dirname+"/views/notice.html"));
});
app.post("/login",(req,res)=>{
res.sendFile(path.join(__dirname+"/views/login.html"));
});
app.listen(5000,console.log("Server started...."));
我不断收到错误“无法发布/登录或无法获取/登录”
解决方案
我检查了代码,它正在我的系统上运行
推荐阅读
- json - 必应地图 - 无法从 JSON/XML 获取地址以进行反向地理编码
- angular - 如何使 JS 函数等待组件以角度加载
- javascript - useState 不更新祖父母状态 - 数据成功地从孙子传递给子,但没有进一步
- drupal - 安装最新的 DKAN 版本时遇到问题?
- spring-boot - 如果我在 java 中使用范围 openid,如何在谷歌身份验证后提取 ID 令牌?
- php - 如何在 League Reader 中跳过重复的(按标题)CSV 列?
- filestream - 允许用户输入信息并发送到文件
- c - 定义一个大小不计空字符的 char 数组
- java - 来自 postgres r2db 的响应花费大量时间导致连接超时
- javascript - 用对象从数组中取出特定值