View server.js
var express = require('express'), | |
app = express(), | |
port = process.env.PORT || 3000; | |
app.listen(port); | |
console.log('Movie app started on port ' + port); |
View test_api.js
'use strict'; | |
var mongoose = require('mongoose'), | |
Item = mongoose.model('Items'); | |
exports.list_all_items = function(req, res) { | |
Item.find({}, function(err, item) { | |
if (err) | |
res.send(err); | |
res.json(item); |
View apache2.conf
... | |
<Directory /var/www/> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
... |
View cleardb_to_local.sh
#This scripts creates a dump file from your ClearDB cloud database (Heroku, Wordpress) | |
#Then changes the siteurl and home columns in the wp_potions table to http://localhost | |
#Then restores your local MySQL database with this .sql file | |
#To get host, run herok config --app appname to get the part that looks like us-fewe-wood-south-20.cleardb.net | |
#Rest can be found in Heroku > app > cleardb > database > stem information | |
mysqldump --host=changeme --user=changeme --password=changeme heroku_changeme > appname-$(date +%F)-cleardb-to-local.sql | |
sed -i -e "s/'siteurl','http:\/\/yourappname.herokuapp.com\/'/'siteurl','http:\/\/localhost'/g" appname-$(date +%F)-cleardb-to-local.sql | |
sed -i -e "s/'home','http:\/\/yourappname.herokuapp.com\/'/'home','http:\/\/localhost'/g" appname-$(date +%F)-cleardb-to-local.sql | |
mysql --host=localhost --user=root --password=CHANGEME databasename < appname-$(date +%F)-cleardb-to-local.sql |
View local_to_cleardb.sh
#This scripts creates a dump file from your local MySQL database | |
#Then changes the siteurl and home columns in the wp_potions table to your Heroku website's url | |
#Then restores your ClearDB cloud database (Heroku, Wordpress) with this .sql file | |
#To get host, run herok config --app appname to get the part that looks like us-fewe-wood-south-20.cleardb.net | |
#Rest can be found in Heroku > app > cleardb > database > stem information | |
mysqldump -u root -pCHANGEME databasename > appname-$(date +%F)-local-to-cleardb.sql | |
sed -i -e "s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g" appname-$(date +%F)-local-to-cleardb.sql | |
sed -i -e "s/'siteurl','https:\/\/localhost'/'siteurl','http:\/\/yourappname.herokuapp.com\/'/g" appname-$(date +%F)-local-to-cleardb.sql | |
sed -i -e "s/'home','https:\/\/localhost'/'home','http:\/\/yourappname.herokuapp.com\/'/g" appname-$(date +%F)-local-to-cleardb.sql |