Skip to content

Instantly share code, notes, and snippets.

@arellano-gustavo
Created May 23, 2021 16:53
Show Gist options
  • Save arellano-gustavo/f561f1112b27c9d1155b7909d03367cf to your computer and use it in GitHub Desktop.
Save arellano-gustavo/f561f1112b27c9d1155b7909d03367cf to your computer and use it in GitHub Desktop.
Mini servicio rest con nodeJs
FROM ubuntu
RUN apt-get update
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN mkdir app
RUN cd app
RUN npm install express --save
COPY pba.js /app
ENTRYPOINT node app/pba.js
--------------------------------------------------------------
const express = require("express");
const app = express();
app.post('/hola', function (req, res) {
res.send('[POST]Saludos desde express 2');
});
app.get('/hola', function (req, res) {
res.send('[GET]Saludos desde express 2');
});
app.listen(3000, () => {
console.log("El servidor está inicializado en el puerto 3000");
});
@arellano-gustavo
Copy link
Author

Este gist realmente contiene 2 archivos:
Dockerfile
pba.js
(los he separado por una linea punteada)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment