Sign inSign up

krll/node-web-app

By krll

•Updated almost 10 years ago

Simple web server via Node js for Docker

Image
0

215

krll/node-web-app repository overview

⁠How to run?
docker run -p 8080:8080 -d krll/node-web-app
⁠How to use? For example
$ mkdir public
$ echo "Hello World" > public/index.html
$ pwd
/home/user
$ docker run -p 8080:8080 -d -v /home/user/public/:/usr/src/app/public --name=app krll/node-web-app
$ docker logs app                                                                                                                          
npm info it worked if it ends with ok                                                                                                                      
npm info using [email protected]                                                                                                                                 
npm info using [email protected]                                                                                                                                 
npm info prestart [email protected]                                                                                                                     
npm info start [email protected]                                                                                                                        
                                                                                                                                                           
> [email protected] start /usr/src/app                                                                                                                  
> node server.js                                                                                                                                           
                                                                                                                                                           
Running on http://localhost:8080
⁠Curl testing
$ curl -i localhost:8080                                                                                                                   
HTTP/1.1 302 Found                                                                                                                                         
X-Powered-By: Express                                                                                                                                      
Location: index.html                                                                                                                                       
Vary: Accept                                                                                                                                               
Content-Type: text/plain; charset=utf-8                                                                                                                    
Content-Length: 32                                                                                                                                         
Date: Tue, 29 Nov 2016 00:12:13 GMT                                                                                                                        
Connection: keep-alive                                                                                                                                     
                                                                                                                                                           
Found. Redirecting to index.html
$ curl -i localhost:8080/index.html                                                                        
HTTP/1.1 200 OK                                                                                                                                            
X-Powered-By: Express                                                                                                                                      
Accept-Ranges: bytes                                                                                                                                       
Cache-Control: public, max-age=0                                                                                                                           
Last-Modified: Mon, 28 Nov 2016 23:42:51 GMT                                                                                                               
ETag: W/"c-158ad51d599"                                                                                                                                    
Content-Type: text/html; charset=UTF-8                                                                                                                     
Content-Length: 12                                                                                                                                         
Date: Tue, 29 Nov 2016 00:12:24 GMT                                                                                                                        
Connection: keep-alive                                                                                                                                     
                                                                                                                                                           
Hello world
⁠See more

https://github.com/krll-k/node-web-app⁠

Tag summary

Content type

Image

Digest

Size

243.7 MB

Last updated

almost 10 years ago

docker pull krll/node-web-app