title: Running JS on localhost - server js
body: <p>I try to run the following script: 
  In terminal I have written: <strong>node server</strong>, but I got an error message:</p>
  
  <blockquote>
    <p>Error: Cannot find module 'express'
        at Function.Module._resolveFilename (module.js:555:15)
        at Function.Module._load (module.js:482:25)
        at Module.require (module.js:604:17)
        at require (internal/module.js:11:18)
        at Object. (/home/jwisniowski/Desktop/PROJEKTY/UJ_API_PEP/shop-app/server.js:1:79)
        at Module._compile (module.js:660:30)
        at Object.Module._extensions..js (module.js:671:10)
        at Module.load (module.js:573:32)
        at tryModuleLoad (module.js:513:12)
        at Function.Module._load (module.js:505:3)</p>
  </blockquote>
  
  <p>sever.js</p>
  
  <pre><code>const express = require('express')
  const app = express()
  const port = process.env.PORT || 3000
  const fs = require('fs')
  const api_endpoint = process.env.API_ENDPOINT || "http://localhost:8081/application-orchestration/v1"
  
  fs.writeFileSync(
    __dirname + '/application-web/config/env.js',
    'var api_endpoint = "' + api_endpoint + '";'
  );
  
  app.use(express.static('./'))
  
  app.get('/', (request, response) =&gt; {
    response.send('Hello from Express!')
  })
  
  app.listen(port, (err) =&gt; {
    if (err) {
      return console.log('something bad happened', err)
    }
  
    console.log(`server is listening on ${port}`)
  })
  </code></pre>