以下範例利用Express實作WebServer

npm install express --save
npm install express-beautify --save

Server.js
      const express = require('express');
      const app = express();
      
      const beautyHTML = require('express-beautify')({
          "indent_with_tabs": true
      });
      app.use(beautyHTML);
      
      app.get('/', function(req, res) {
          res.send('

測試網頁

\n' + '

歡迎光臨123456789

\n
你好阿~'); }); var server = app.listen(8000, function() { console.log('Listening on port 8000'); });

酷米 © All Rights Reserved.

loading
Loading...