我正在尋找使用hapi.js教程製作簡單的Hello World。hapi.js入門
我已經安裝了高致病性禽流感:
npm init
npm install hapi --save
- 我得到一個大組文件夾與文件
我想這樣做node index.js
這給了我的錯誤。所以我cd
到node_modules
並且在運行node
時得到了另一個錯誤。我再次將cd
轉換爲hapi
,並在運行node index.js
時再次出現錯誤。我添加了教程中的所有語法。
var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 8000
});
// Add the route
server.route({
method: 'GET',
path:'/hello',
handler: function (request, reply) {
reply('hello world');
}
});
// Start the server
server.start();
不知道我應該在哪裏index.js
錯誤信息請?在node_modules中運行程序不會帶來任何收益 – gregnr 2015-03-31 18:01:41
好的,這很有道理。我製作了一個app.js文件,並能夠讓所有的東西在那裏工作。但是,它位於node_modules中。當我npm安裝hapi時,我得到了多個文件夾中的文件。我是否忽略這些並且爲mvc創建我的通常文件夾? – Winnemucca 2015-04-01 00:06:00
是的 - 查看我的答案 – gregnr 2015-04-01 02:14:25