1. 程式人生 > >快速本地搭建一個純靜態簡易站點

快速本地搭建一個純靜態簡易站點

const cal code nav con 項目部署 ole 程序 port

技術分享圖片

app.js

const http = require(‘http‘)

const homePage = `
<!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">
    <
title>Nodejs 部署上線示例(隨時失效)</title> <style> *{ padding: 0; margin: 0; } body{ padding: 30px 0; text-align: center; font-size: 16px; background-color: #333; } h1,h2{ color
: #fff; } nav{ margin-top:20px; } a{ color: #ccc; text-decoration: none; } a:hover{ text-decoration: underline; } </style> </head> <body> <h1>Nodejs 高級課程</h1> <
h2>項目部署上線示例</h2> <nav> <ul> <li><a href="/a" target="_blank">Nodejs 電影網站</a></li> <li><a href="/b" target="_blank">狗狗說 App後臺</a></li> <li><a href="/c" target="_blank">微信小程序後臺</a></li> <li><a href="/d" target="_blank">微信公眾號後臺</a></li> </ul> </nav> </body> </html> ` http.createServer((req, res) => { res.statusCode = 200 res.setHeader(‘Content-Type‘, ‘text/html‘) res.end(homePage) }) .listen(3000, ()=>{ console.log(‘Server Running At 3000‘); })

技術分享圖片

快速本地搭建一個純靜態簡易站點