Skip to content

Simplest possible template with Docker, NodeJS and a webserver

License

Notifications You must be signed in to change notification settings

mapic/docker-nodejs-webserver-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-nodejs-webserver-template

Simplest possible template with Docker, NodeJS and a webserver

FROM node:12-alpine
ADD ./server.js
CMD server.js
const net = require('net');
const port = 8080;

const server = net.createServer();

server.listen(port, function() {
    console.log('listening on', port);
});

server.on('connection', function(socket) {
    
    console.log('connection');
    
    socket.write('Oh hi there!');
    
    socket.on('data', function(chunk) {
        console.log('data:', chunk.toString());
    });
    socket.on('end', function() {
        console.log('end');
    });
    socket.on('error', function(err) {
        console.log('error:', err);
    });

});

About

Simplest possible template with Docker, NodeJS and a webserver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published