resize-server icon indicating copy to clipboard operation
resize-server copied to clipboard

Now resize-server is modular

Open jcguarinpenaranda opened this issue 8 years ago • 0 comments

I did several changes:

  1. Removed node_modules that were git tracked on the package
  2. Installed new dependencies, updating express to a more recent version, and using body-parser instead of express.bodyParser
  3. Created and index.js file that contains the code that was before on server.js, but instead of running the server in that file, exporting an express.Router variable to allow modularity with other services. This means that resize-server can now be used by other express based apps. (more on this later)
  4. Edited server.js to run the server as standalone if desired, with npm start

Regarding the modularity, the creation of the index.js file means that on other server you could do:

let resizeApp = require('resize-server'); // or the name of the package on npm
let express = require('express');
let app = express();

app.use('/resize', resizeApp);

// run
app.listen(12345);

jcguarinpenaranda avatar May 14 '17 17:05 jcguarinpenaranda