File tree Expand file tree Collapse file tree 6 files changed +88
-1
lines changed
Expand file tree Collapse file tree 6 files changed +88
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ phoenix:
1010 docker build -t phoenix elixir/phoenix
1111
1212# --- node.js ---
13- node : express fastify polka rayo koa restify
13+ node : express fastify polka rayo koa restify hapi
1414
1515express :
1616 docker build -t express node/express
3030restify :
3131 docker build -t restify node/restify
3232
33+ hapi :
34+ docker build -t hapi node/hapi
35+
3336# --- Objective-C ---
3437objc : criollo
3538
Original file line number Diff line number Diff line change 7474 - rayo
7575 - koa
7676 - restify
77+ - hapi
7778
7879elixir :
7980 dependencies :
@@ -291,6 +292,12 @@ restify:
291292 - docker build -t restify .
292293 directory : node/restify
293294
295+ hapi :
296+ commands :
297+ - docker build -t hapi .
298+ directory : node/hapi
299+
300+
294301plug :
295302 commands :
296303 - docker build -t plug .
Original file line number Diff line number Diff line change 1+ FROM node
2+
3+ RUN npm -g install pm2
4+
5+ WORKDIR /usr/src/app
6+
7+ COPY app.js package.json ./
8+
9+ RUN npm install
10+
11+ ENV NODE_ENV production
12+
13+ CMD pm2-runtime start app.js -i $(nproc)
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const Hapi = require ( "hapi" ) ;
4+
5+ // Create a server with a host and port
6+ const server = Hapi . server ( {
7+ host : "0.0.0.0" ,
8+ port : 3000
9+ } ) ;
10+
11+ // Add the route
12+ server . route ( {
13+ method : "GET" ,
14+ path : "/" ,
15+ handler : function ( req , handler ) {
16+ return "" ;
17+ }
18+ } ) ;
19+
20+ server . route ( {
21+ method : "GET" ,
22+ path : "/user/{id}" ,
23+ handler : function ( req , handler ) {
24+ return req . params . id ;
25+ }
26+ } ) ;
27+
28+ server . route ( {
29+ method : "POST" ,
30+ path : "/user" ,
31+ handler : function ( req , handler ) {
32+ return "" ;
33+ }
34+ } ) ;
35+
36+ // Start the server
37+ async function start ( ) {
38+ try {
39+ await server . start ( ) ;
40+ } catch ( err ) {
41+ console . log ( err ) ;
42+ process . exit ( 1 ) ;
43+ }
44+
45+ console . log ( "Server running at:" , server . info . uri ) ;
46+ }
47+
48+ start ( ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " express" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " app.js" ,
6+ "dependencies" : {
7+ "hapi" : " 17.5.1"
8+ },
9+ "devDependencies" : {},
10+ "scripts" : {
11+ "test" : " echo \" Error: no test specified\" && exit 1"
12+ },
13+ "author" : " " ,
14+ "license" : " ISC"
15+ }
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ LANGS = [
7979 {name: " rayo" , repo: " GetRayo/rayo.js" },
8080 {name: " koa" , repo: " koajs/koa" },
8181 {name: " restify" , repo: " restify/node-restify" },
82+ {name: " hapi" , repo: " hapijs/hapi" },
8283 ]},
8384 {lang: " elixir" , targets: [
8485 {name: " plug" , repo: " elixir-lang/plug" },
You can’t perform that action at this time.
0 commit comments