引导程序无法正常工作。尽我所能尝试了所有方法,但仍然没有成功

时间:2019-03-05 16:16:18

标签: html node.js twitter-bootstrap

我目前正在使用Node js应用程序,因此我刚开始想为登录/注册创建主页。但是,当尝试实现引导时,我不确定为什么它不起作用。这是代码:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
  <link rel="stylesheet" href="https://bootswatch.com/4/journal/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

  <title>Node.js & Passport App</title>
</head>
<body>
  <div class="container">
    <%- body %>

  </div>


  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

enter image description here

index.js

const express = require('express');
const router = express.Router();



router.get('/', (req, res) => res.render('welcome'));

module.exports = router;

users.js

const express = require('express');
const router = express.Router();


// Login Page
router.get('/login', (req, res) => res.send('Login'));

// Register Page
router.get('/register', (req, res) => res.send('Register'));

module.exports = router;

1 个答案:

答案 0 :(得分:0)

好吧...

如果不看完整的代码,就不可能为您提供帮助。

您在这里选择welcome.ejs文件: enter image description here

该文件不包含引导程序引用:enter image description here

因此,浏览器中的源代码如下所示(它甚至没有html头或主体): enter image description here

问题:您到底想做什么?