##TXN
###Dev Startup
nf start -x 8080 -e env/dev.env
###What
Messing around with various APIs (Stripe), technologies (AJAX calls w/ client side jQuery), and monitoring and analytics platforms.
For example, wouldn't it be cool if you set an SMS alert to notify you when there's a new craigslist post on super hard-to-find apartments in SF?
Or if you receive a payment on Stripe, send a Twitter message saying #WINRAR
?
###Integration list
###Stack
- Javascript library: jQuery
- Templating engine: handlebars.js
- MVC framework: express
- Server side language: node.js
- Object-relational mapping: sequlize.js
- Database: PostgreSQL
###Install
Clone the repository
$ git clone https://github.com/skilbjo/txn.git
Install modules and dependencies
$ npm install
Add secret API keys from the super secret email
$ vim .env
Configure the database (assuming postgres
is running at /usr/local/var/postgres
)
$ postgres -D /usr/local/var/postgres
Ensure the following returns a list of dbs:
$ psql
> skilbjo=# \list
Configuration is now done... time to run the app :D
$ node server.js
Then view the app your browser: http://localhost:8080
###Deploy
git commit -am 'heroku' && git push && git push heroku master
heroku ps
heroku logs -t
heroku open
###Follow Up
- Switch to jade for templating
- Twilio API
- Paypal API
- Write tests (make tests, Makefile)
- Use Flash messages
###Useful tricks
If for some reason you get something like this:
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
there are likely two node
servers running. Close a terminal window and start again. But in case that doesn't work... $ killall node
Another issue gets you this error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
Just run this: $ postgres -D /usr/local/var/postgres --fork
or $ postgres -D /usr/local/var/postgres
to start the database (and to kill the database process, run $ killall postgres
)