After node.js calls the router module, the access address reports an error Cannot Get/login?.

problem description

No error was reported after running server.js using app.use mount route"/ login", in server.js, but an error was reported when accessing the route. Cannot Get/login, still doesn"t know what the problem is. This problem will not occur if you use app.post.

related codes

. / routes/login/index.js

var express = require("express");
const router = express.Router();
    router.get("/login",function(req,res){
        res.send("OK");
    });
module.exports = router;

server.js

var express = require("express");
var app = express();
var loginRoute = require("./routes/login/index.js");
app.use("/login",loginRoute);

there is no error reported on the server. I don"t know what the problem is. According to reason should be able to return to OK, please help to have a look, thank you!

Apr.20,2021

this is / login/login , change it to

router.get('/',function(req,res){
        res.send("OK");
    });

like you said upstairs, you wrapped an extra layer.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-4a94c18-18004.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-4a94c18-18004.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?