{"id":22273537,"url":"https://github.com/dfleta/pushmees_pullmees","last_synced_at":"2026-04-11T06:02:17.987Z","repository":{"id":94648392,"uuid":"430691798","full_name":"dfleta/pushmees_pullmees","owner":"dfleta","description":"Students project to learn how to develop an API Rest with Express","archived":false,"fork":false,"pushed_at":"2022-04-04T00:56:17.000Z","size":165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-03T17:24:34.044Z","etag":null,"topics":["express","javascript","jest","mongodb-atlas","mongoose","node","nodejs","supertest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dfleta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-22T12:09:45.000Z","updated_at":"2024-04-27T09:53:25.000Z","dependencies_parsed_at":"2023-07-28T22:15:11.101Z","dependency_job_id":null,"html_url":"https://github.com/dfleta/pushmees_pullmees","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dfleta/pushmees_pullmees","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfleta%2Fpushmees_pullmees","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfleta%2Fpushmees_pullmees/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfleta%2Fpushmees_pullmees/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfleta%2Fpushmees_pullmees/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfleta","download_url":"https://codeload.github.com/dfleta/pushmees_pullmees/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfleta%2Fpushmees_pullmees/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31670383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","javascript","jest","mongodb-atlas","mongoose","node","nodejs","supertest"],"created_at":"2024-12-03T13:13:12.084Z","updated_at":"2026-04-11T06:02:17.971Z","avatar_url":"https://github.com/dfleta.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Express\n\nhttps://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/development_environment\n\n\n## 1. Setting up a Node development environment\n\n\nEl código de esta parte del tutorial está en el directorio: `node_project_setup`\n\n### Instalar Node\n\n```\ncurl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -\nsudo apt-get install -y nodejs\n```\n\n### Testing your Nodejs and NPM installation\n\n```\n\u003e node -v\nv16.13.0\n\n\u003e npm -v\n8.1.0\n```\n\nCopy the following text into a file named hellonode.js. This uses pure Node features (nothing from Express) and some ES6 syntax:\n\n```js\n//Load HTTP module\nconst http = require(\"http\");\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\n//Create HTTP server and listen on port 3000 for requests\nconst server = http.createServer((req, res) =\u003e {\n\n  //Set the response HTTP header with HTTP status and Content type\n  res.statusCode = 200;\n  res.setHeader('Content-Type', 'text/plain');\n  res.end('Hello World\\n');\n});\n\n//listen for request on port 3000, and as a callback function have the port listened on logged\nserver.listen(port, hostname, () =\u003e {\n  console.log(`Server running at http://${hostname}:${port}/`);\n});\n```\n\n\nStart the server by navigating into the same directory as your hellonode.js file in your command prompt. Navigate to the URL http://127.0.0.1:3000 \n\n```\n\u003enode hellonode.js\nServer running at http://127.0.0.1:3000/\n```\n\n### Using NPM - installing Express\n\nUse the npm init command to create a package.json file for your application.\nThe initial entry point file (by default this is index.js)\n\npackage.json\n\n```js\n{\n  \"name\": \"pushmees_pullmees\",\n  \"version\": \"1.0.0\",\n  \"description\": \"students project to learn Express\",\n  \"main\": \"index.js\",                                   \u003c======= entrypoint\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" \u0026\u0026 exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/dfleta/pushmees_pullmees.git\"\n  },\n  \"keywords\": [\n    \"Express\",\n    \"node\",\n    \"API\",\n    \"REST\"\n  ],\n  \"author\": \"David Gelpi\",\n  \"license\": \"ISC\",\n  \"bugs\": {\n    \"url\": \"https://github.com/dfleta/pushmees_pullmees/issues\"\n  },\n  \"homepage\": \"https://github.com/dfleta/pushmees_pullmees#readme\"\n}\n```\n\n```\n\u003e npm install express\n\n  \"dependencies\": {\n    \"express\": \"^4.17.1\"        \u003c====  \n  },  \n```\n\nCreamos el entrypoint `index.js`\n\ny copiamos este código:\n\n```js\nconst express = require('express')\nconst app = express();\nconst port = 8000;\n\napp.get('/', (req, res) =\u003e {\n  res.send('Hello World!')\n});\n\napp.listen(port, () =\u003e {\n  console.log(`Example app listening on port ${port}!`)\n});\n```\n\nLanzamos la app y navigate to the URL (http://127.0.0.1:8000/):\n\n```\n\u003e node index.js\nExample app listening on port 8000\n```\n\n#### Development dependencies\n\nIf a dependency is only used during development, you should instead save it as a \"development dependency\" (so that your package users don't have to install it in production). \n\n\u003e npm install eslint --save-dev\n\n```js\n  \"devDependencies\": {\n    \"eslint\": \"^8.3.0\"\n  }\n```\n\n#### Running tasks\n\nYou can define named scripts in your package.json files and call NPM to execute them with the run-script command. This approach is commonly used to automate running tests and parts of the development or build toolchain.\n\nto define a script to run the eslint development dependency that we specified in the previous section\n\n```js\n\"scripts\": {\n  ...\n  \"lint\": \"eslint src/js\"\n  ...\n}\n```\n\n```\nnpm run-script lint\n# OR (using the alias)\nnpm run lint\n```\n\n\n### Installing the Express Application Generator\n\nhttps://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/skeleton_website\n\n**Es necesario crear un nuevo directorio donde situar el projecto.**\n\nDirectorio `pushmees_pullmees`\n\nThe Express Application Generator tool generates an Express application \"skeleton\". Install the generator using NPM as shown.\n\nYou may need to prefix this line with sudo on Ubuntu or macOS. The -g flag installs the tool globally so that you can call it from anywhere (aun o disponemos de package.json en este proyecto)\n\n\u003e npm install express-generator -g\n\nSi es necesario actualizar npm por las vulnerabilidades de la versión anterior:\n\n\u003e npm install -g npm@8.1.4\n\n\nIf you're using NodeJS version \u003e 8.2.0 or latest, you can skip the installation and run express-generator with npx:\n\n\u003e npx express-generator helloworld\n\n\nComprobamos:\n\n\u003e express --version\n4.16.1\n\nLeer las opciones para configurar el proyecto\n\n```\n\u003e express --help\n\n    Usage: express [options] [dir]\n\n  Options:\n\n        --version        output the version number\n    -e, --ejs            add ejs engine support\n        --pug            add pug engine support\n        --hbs            add handlebars engine support\n    -H, --hogan          add hogan.js engine support\n    -v, --view \u003cengine\u003e  add view \u003cengine\u003e support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)\n        --no-view        use static html instead of view engine\n    -c, --css \u003cengine\u003e   add stylesheet \u003cengine\u003e support (less|stylus|compass|sass) (defaults to plain css)\n        --git            add .gitignore\n    -f, --force          force on non-empty directory\n    -h, --help           output usage information\n  ```\n\n\nThe Express Application Generator allows you to configure a number of popular view/templating engines, including EJS, Hbs, Pug (Jade), Twig, and Vash, although it chooses Jade by default if you don't specify a view option.\n\n```\n\u003e express pushmees_pullmees --view=pug\n\n   create : pushmees_pullmees/\n   create : pushmees_pullmees/public/\n   create : pushmees_pullmees/public/javascripts/\n   create : pushmees_pullmees/public/images/\n   create : pushmees_pullmees/public/stylesheets/\n   create : pushmees_pullmees/public/stylesheets/style.css\n   create : pushmees_pullmees/routes/\n   create : pushmees_pullmees/routes/index.js\n   create : pushmees_pullmees/routes/users.js\n   create : pushmees_pullmees/views/\n   create : pushmees_pullmees/views/error.pug\n   create : pushmees_pullmees/views/index.pug\n   create : pushmees_pullmees/views/layout.pug\n   create : pushmees_pullmees/app.js\n   create : pushmees_pullmees/package.json\n   create : pushmees_pullmees/bin/\n   create : pushmees_pullmees/bin/www\n\n   change directory:\n     $ cd pushmees_pullmees\n\n   install dependencies:\n     $ npm install\n\n   run the app:\n     $ DEBUG=pushmees-pullmees:* npm start\n```\n\nCrea el directorio pushmess_pullmess y el proyecto dentro.\n\n### Running the skeleton website\n\nInstalamos las dependencias del proyecto indicadas en el package.json:\n\n```js\n\"dependencies\": {\n    \"cookie-parser\": \"~1.4.4\",\n    \"debug\": \"~2.6.9\",\n    \"express\": \"~4.16.1\",\n    \"http-errors\": \"~1.6.3\",\n    \"morgan\": \"~1.9.1\",\n    \"pug\": \"2.0.0-beta11\"\n  }\n```\n\n```\ncd express-locallibrary-tutorial\nnpm install\n```\n\nRecibimos varios avisos severos de vulnerabilidades (la de pug la más alta) y las corregimos ejecutando tantes veces como sea necesario el comando `npm audit` para actualizar a las versiones adecuadas:\n\n\u003e npm audit fix --force\n\n\nRun the app\n\n    On macOS or Linux, use this command:\n\n    DEBUG=express-locallibrary-tutorial:* npm start\n\n    On the Windows CMD prompt, use this command:\n\n    SET DEBUG=express-locallibrary-tutorial:* \u0026 npm start\n\n    On Windows Powershell, use this command:\n\n    $ENV:DEBUG = \"express-locallibrary-tutorial:*\"; npm start\n\n\nSi el puerto 3000 estuviese ocupado:\n\nhttps://code-examples.net/es/q/8e9ca3\n\n```\n$ lsof -t -i:3000\n4587\n18798\n$ sudo kill -9 18798\n```\n\n```\n$ DEBUG=pushmees_pullmees:* npm start\n\n\u003e pushmees-pullmees@0.0.0 start\n\u003e node ./bin/www\n```\n\nEn http://localhost:3000/ está la app.\n\n\nSpecifying the DEBUG variable as shown enables console logging/debugging. Al visitar el sitio, en consola recibo:\n\n    GET / 200 239.662 ms - 170\n    GET /stylesheets/style.css 200 10.206 ms - 111\n\n\nAhora invocaremos arrancar la app con debugging desde los scripts de npm. \n\n### Enable server restart on file changes\n\nA convenient tool for this purpose is nodemon. This is usually installed globally (as it is a \"tool\"), but here we'll install and use it locally as a developer dependency, so that any developers working with the project get it automatically when they install the application. Use the following command in the root directory for the skeleton project:\n\n\u003e npm install --save-dev nodemon\n\nY en el `package.json`\n```js\n\"devDependencies\": {\n    \"nodemon\": \"^2.0.15\"    \u003c== añadida dependencia desarrollo\n}\n```\n\nBecause the tool isn't installed globally we can't launch it from the command line (unless we add it to the path) but we can call it from an NPM script because NPM knows all about the installed packages.\n\nThe devstart and serverstart scripts can be used to start the same ./bin/www file with nodemon rather than node:\n\n```js\n\"scripts\": {\n      \"start\": \"node ./bin/www\",\n      \"devstart\": \"nodemon ./bin/www\",\n      \"serverstart\": \"DEBUG=pushmees_pullmeesh:* npm run devstart\"  \u003c== invocamos otro script npm\n},\n```\n\n    \u003e npm run serverstart\n\n    pushmees-pullmees@0.0.0 serverstart\n    DEBUG=pushmees_pullmeesh:* npm run devstart\n\n\n    pushmees-pullmees@0.0.0 devstart\n    nodemon ./bin/www\n\n    [nodemon] 2.0.15\n    [nodemon] to restart at any time, enter `rs`\n    [nodemon] watching path(s): *.*\n    [nodemon] watching extensions: js,mjs,json\n    [nodemon] starting `node ./bin/www`         \u003c=== invocando al script npm devstart =\u003e nodemon\n\n\n### The generated project\n\n\nAquí el repo del proyecto ejemplo de Mozilla MZDN:\n\nhttps://github.com/mdn/express-locallibrary-tutorial \n\n\n#### Directory structure\n\n The package.json file defines the application dependencies and other information. It also defines a startup script that will call the application **entry point**, the JavaScript file /bin/www. This sets up some of the application error handling and then **loads app.js** to do the rest of the work. The **app routes are stored in separate modules under the routes/ directory**. The **templates** are stored under the /views directory. \n \n\n    express-locallibrary-tutorial\n        app.js\n        /bin\n            www\n        package.json\n        package-lock.json\n        /node_modules\n            [about 6700 subdirectories and files]\n        /public\n            /images\n            /javascripts\n            /stylesheets\n                style.css\n        /routes\n            index.js\n            users.js\n        /views\n            error.pug\n            index.pug\n            layout.pug\n\n#### www file\n\nThe file /bin/www is the application entry point! \nThe very first thing this does is require() the \"real\" application entry point (app.js, in the project root) that sets up and returns the express() application object.\n\n```js\n    #!/usr/bin/env node\n\n    /**\n      * Module dependencies.\n    */\n\n    var app = require('../app');\n```\n\nThe remainder of the code in this file sets up a node HTTP server with app set to a specific port (defined in an environment variable or 3000 if the variable isn't defined), and starts listening and reporting server errors and connections. \n\n#### app.js\n\nThis file creates an express application object (named app, by convention), sets up the application with various settings and middleware, and then exports the app from the module. \n\n```js\nvar express = require('express');\nvar app = express();\n...\nmodule.exports = app;\n```\n\nBack in the www entry point file above, it is this module.exports object that is supplied to the caller when this file is imported.\n\n#### Routes directory\n\nThen we require() modules from our routes directory. These modules/files contain code for handling particular sets of related \"routes\" (URL paths)\n\n```js\nvar indexRouter = require('./routes/index');\nvar usersRouter = require('./routes/users');\n```\n\n#### Views Engine\n\nNext, we create the app object using our imported express module, and then use it to set up the view (template) engine. There are two parts to setting up the engine. First, we set the 'views' value to specify the folder where the templates will be stored (in this case the subfolder /views). Then we set the 'view engine' value to specify the template library (in this case \"pug\").\n\n```js\nvar app = express();\n// view engine setup\napp.set('views', path.join(__dirname, 'views'));\napp.set('view engine', 'pug');\n```\n\n#### MIDDLEWARE\n\nThe next set of functions call app.use() to add the middleware libraries into the request handling chain. In addition to the 3rd party libraries we imported previously, we use the express.static middleware to get Express to serve all the static files in the /public directory in the project root. \n\n```js\napp.use(logger('dev'));\napp.use(express.json());\napp.use(express.urlencoded({ extended: false }));\napp.use(cookieParser());\n\napp.use(express.static(path.join(__dirname, 'public')));\n```\n\nNow that all the other middleware is set up, we add our (previously imported) route-handling code to the request handling chain. The imported code will define particular routes for the different parts of the site:\n\n```js\napp.use('/', indexRouter);\napp.use('/users', usersRouter);\n```\n\nNote: The paths specified above ('/' and '/users') are treated as a prefix to routes defined in the imported files. So for example, if the imported users module defines a route for /profile, you would access that route at /users/profile. We'll talk more about routes in a later article.\n\n...\n\n#### Routes\n\nThe route file /routes/users.js is shown below (route files share a similar structure, so we don't need to also show index.js). \nFirst, it loads the express module and uses it to get an express.Router object. Then it specifies a route on that object and lastly exports the router from the module (this is what allows the file to be imported into app.js).\n\n```js\nvar express = require('express');\nvar router = express.Router();\n\n/* GET users listing. */\nrouter.get('/', function(req, res, next) {\n  res.send('respond with a resource');\n});\n\nmodule.exports = router;\n```\n\n### Control de versiones\n\nEl \"oficial\" de github:\n\nhttps://github.com/github/gitignore/blob/master/Node.gitignore\n\nEl directorio `node_modules` es el que obviamente queda sin seguimiento.\n\n\n## Conexión a BBDD\n\n### Install Mongoose\n\nInstall Mongoose (and its dependencies) and add it to your `package.json` file:\n\n\u003e npm install mongoose\n\nOpen `/app.js` (in the root of your project) and copy the following text below where you declare the Express application object (after the line var app = express();). \n\nEsta sintaxis es de Node.\n\n    //Set up mongoose connection\n    var mongoose = require('mongoose');\n    var mongoDB = 'insert_your_database_url_here';\n    mongoose.connect(mongoDB, { useNewUrlParser: true , useUnifiedTopology: true});\n    var db = mongoose.connection;\n    db.on('error', console.error.bind(console, 'MongoDB connection error:'));\n\n\n### Defining the Schema(s)\n\nWe will define a separate module for each model. \nStart by creating a folder for our models in the project root (/models) and then create separate files for each of the models. Example:\n\n/express-locallibrary-tutorial  //the project root\n  /models\n    author.js\n    book.js\n    bookinstance.js\n    genre.js\n\nDefinimos el schema de mrmeeseeks. \n\nEcharle un ojo a los **tipos** de los schemas:\n\nhttps://mongoosejs.com/docs/schematypes.html \n\nAquí los **validators** para validar los datos definidos en el schema:\n\nhttps://mongoosejs.com/docs/validation.html\n\nValidation is middleware. Mongoose registers validation as a pre('save') hook on every schema by default.\n\nSólo hay built-in validators para `Number` y `String`\n\n## Seguridad\n\nEnvironmentVariables in Ubuntu:\n\nhttps://help.ubuntu.com/community/EnvironmentVariables\n\nHow to read environment variables from Node.js\n\nhttps://nodejs.dev/learn/how-to-read-environment-variables-from-nodejs\n\ntemplate literals:\n\nhttps://novatfe.com/es/evento/20-que-es-la-impresion-en-3d-y-sus-aplicaciones\n\nEncrypted password in `.env` or environment variables: \n\nhttps://stackoverflow.com/questions/65564126/encrypt-passwords-stored-in-environment-variables\n\n### Solución I\n\n\u003e $ sudo pico /etc/profile.d/development_env.sh\n\u003e export ATLAS_USER=\"user\"\n\u003e export ATLAS_PASSWORD=\"password\"\n\nCerrar la sesión y volver a entrar para forzar la carga de las variables de entorno.\n\nUsar el paquete `process` de `node` para acceder al entorno y leer las variables en `app.js`\n\n\u003e var mongoDB = `mongodb+srv://${process.env.ATLAS_USER}:${process.env.ATLAS_PASSWORD}@cluster0-ud3ms.mongodb.net/pushmees_pullmees?retryWrites=true\u0026w=majority`;\n\nDe este modo, al menos puedo compartir con el alumnado el proyecto para que cambien 3 parámetros y a correr, y evito gestionar 2 ramas en el repo sólo para este fin.\n\n### Solucion II\n\nFichero local .env con user y password encriptado. Sólo para desarrollo local. Si alguien accede al repo, lee la clave de encriptación... así que no se gana nada.\n\n\n\u003e require('dotenv').config()\n\n\u003e var CryptoJS = require(\"crypto-js\");\n\u003e var data = \"password\";\n\u003evar encrypted = CryptoJS.AES.encrypt(data, \"my-secret\");\n\u003e console.log(encrypted.toString());\n\n\nAquí soluciones para la vida real:\n\nhttps://stackoverflow.com/questions/65564126/encrypt-passwords-stored-in-environment-variables\n\n\n## Testing\n\nsupertest\n\nhttps://www.npmjs.com/package/supertest\n \ntesting express framework with jest \n\nhttps://www.albertgao.xyz/2017/05/24/how-to-test-expressjs-with-jest-and-supertest/\n\n\u003e npm install jest supertest --save-dev\n\n\ntesting asyncronous code with promises\n\nhttps://jestjs.io/docs/asynchronous\n\n\nTesting con Jest y supertest, artículo y repo con ejemplos:\n\nhttps://dev.to/nedsoft/testing-nodejs-express-api-with-jest-and-supertest-1km6\n\nhttps://github.com/nedssoft/sequelize-with-postgres-tutorial/blob/master/tests/routes.test.js\n\n\nVídeo: How to test MongoDB related functionality with Jest in TypeScript\n\nhttps://www.youtube.com/watch?v=4U1DXyZUw34\n\n\nConnect to a MongoDB Database Using Node.js\n\nhttps://www.mongodb.com/blog/post/quick-start-nodejs-mongodb-how-to-get-connected-to-your-database\n\nInstalar cross-env para desde linea de comandos npm fijar la variable de entorno `NODE_ENV` en `package.json`:\n\n\u003e \"test\": \"cross-env NODE_ENV=test jest --runInBand --detectOpenHandles\"\n\nNODE_ENV=development\nNODE_ENV=production\nNODE_ENV=test\n\n\u003e npm install cross-env --save-dev\n\n\nAl correr los test ejecutar la opción de `jest --detectOpenHandles` para averiguar si hay conexiones o tareas asíncronas por manejar que impidan la salida de los tests:\n\n\u003e \"test\": \"cross-env NODE_ENV=test jest --runInBand --detectOpenHandles\n\n\n### Setup de la bbdd MongoDB\n\nhttps://docs.mongodb.com/drivers/node/current/quick-start/\n\n lo guay seria tener dos bases de datos\n una para prod y otra para test como en quarkus\n y arrancar segun var env\n sequelize tiene un script para migrar \n y resetear la bbdd\n mongo tb?\n en teoria eso lo deberia hacer mongoose\n que no tiene una cli como sequelize y por tanto\n no puedo lanzarl con npm script pretest y migrate\n\n## GraphQL\n\n\nhttps://dev.to/nedsoft/build-api-with-graphql-node-js-and-sequelize-5e8e\n\n\n## Docker\n\nDockerfile\n\n```Dockerfile\nFROM node:lts-alpine\nENV NODE_ENV=production\nENV ATLAS_USER=\"user\"\nENV ATLAS_PASSWORD=\"password\"\nWORKDIR /usr/src/app\nCOPY [\"package.json\", \"package-lock.json*\", \"npm-shrinkwrap.json*\", \"./\"]\nRUN npm install --production --silent \u0026\u0026 mv node_modules ../\nCOPY . .\nEXPOSE 3000\nRUN chown -R node /usr/src/app\nUSER node\nCMD [\"npm\", \"start\"]\n```\n\nCreo la imagen:\n\n`$ docker build -t push_mees .`\n\nCreo el contenedor y ejecutarlo:\n\n`$ docker run -dp 3000:3000 push_mees:latest`\n\nCompruebo si `COPY` y `dockerignore` han hecho su trabajo y copiado sólo los componentes de la app:\n\n```sh\n$ docker exec -it optimistic_kapitsa sh\n/usr/src/app $ ls\napp.js             controllers        domain             package-lock.json  public             views\nbin                db                 models             package.json       routes\n```\n\nPara el contenedor:\n\n`$ docker stop name` \n\nPonlo en marcha:\n\n`$ docker stop name`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfleta%2Fpushmees_pullmees","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfleta%2Fpushmees_pullmees","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfleta%2Fpushmees_pullmees/lists"}