Skip to content

Conversation

@jcguarinpenaranda
Copy link

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);

Changed to allow other express based servers to import it and expose it on other urls
Before all the express configuration was being made here, and now you can run this as a server, or simply import this as a module, using the exported variable on the index.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant