• 跟我一起从零开始一个预告片电影网站(二)


    接下来我们完成一个服务端返回html静态页面
    第一步

    cd server/
    mkdir tpl
    cd tpl
    touch normal.js
    
    //normal.js
    module.exports=`
    <!DOCTYPE html>
    <html>
        <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <title>Koa Server Html</title>
        <script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js" type="javascript"></script>
        <link href="https://cdn.bootcss.com/twitter-bootstrap/4.4.1/css/bootstrap.min.css"  rel="stylesheet" type="text/css"/>
        <script src="https://cdn.bootcss.com/twitter-bootstrap/4.0.0/js/bootstrap.bundle.min.js" type="javascript"></script>
        </head>
            <div class="container">
                <div class="row">
                    <div class="col-md-8">
                        <h1>Hi Luke</h1>
                        <p> this is scott</p>
                    </div>
                    <div class="col-md-4">
                        <p>测试静态HTML页面</p>
                    </div>
                </div>
               
            </div>
    </html>
    `
    
    touch index.js
    
    //tpl/index.js
    const normalTpl = require('./normal')
    module.exports={
        normal:normalTpl
    }
    

    运行代码

    npm start
    

    页面效果为

    按道理说应该一行显示的不知道为什么不是一行,应该是cdn的问题

  • 相关阅读:
    C++ 派生类对象的构造与析构过程
    C++ lvalue(左值)和rvalue(右值)
    enum class 用法
    gcc 编译选项
    using用法总结
    const用法及与constexpr区别总结
    Lanbda表达式
    CMake 用法总结(转载)
    ElasticSearch学习文档
    Maven学习笔记
  • 原文地址:https://www.cnblogs.com/smart-girl/p/12514402.html
Copyright © 2020-2023  润新知