Created
May 23, 2021 16:53
-
-
Save arellano-gustavo/f561f1112b27c9d1155b7909d03367cf to your computer and use it in GitHub Desktop.
Mini servicio rest con nodeJs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Este gist realmente contiene 2 archivos:
Dockerfile
pba.js
(los he separado por una linea punteada)