typpo/textbelt — pull request #24 by soondobu (2014-10-06 06:17:07+00:00)
Title: Separate server and text logic to enable functioning as a module

Hi!

First off, thanks so much for taking the time to review these changes :) I really liked the simplicity of the implementation and thought i'd propose a few changes to make it flexible for some other use cases.

This pull request contains a few commits which make a series of slight changes to allow textbelt to also function as a standalone module, rather than exclusively as a web app. This allows end users to simply require('textbelt') and start sending texts from their servers right away, rather than having to first POST to their own instance or the global instance.

There is also an open issue (#17) which would be addressed by accepting this pull request. Here is a rundown:

- Create lib & server folders, move all express/app related into server, update all relevant paths & script (210b0ae).
- Extract `sendText` from app.js into lib/text, which now forms the bulk of the sending logic (ce1ded5).
- Add a top level index.js, which exports lib/text. This enables the requiring of the app (a194086).
- Bugfix: Missing semicolon and variable declaration (cfc6293).
- Finally, update README on how to use as a module (b33d31a).

If you have any questions or concerns, please feel free to let me know and I can update the request. I tested this locally and verified it works as intended as well :)