Node.js 服務器端框架:Hapi.js
Hapi.js 是一個用來構建基于 Node.js 的應用和服務的Rich框架,讓開發者把精力放在編寫可復用的應用邏輯而不是構建架構。內建輸入驗證、緩存、認證和其他 Web 應用開發常用的功能。
示例代碼:
var Hapi = require('hapi'); // Create a server with a host and port var server = new Hapi.Server('localhost', 8000); // Add the route server.route({ method: 'GET', path: '/hello', handler: function (request, reply) { reply('hello world'); } }); // Start the server server.start();
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!