This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.putById = function (req, res){ | |
console.log(req.body); | |
regModel.findById(req.params.id, function (err, entry) { | |
for (key in req.body){ | |
entry[key] = req.body[key]; | |
} | |
entry.save(function (err) { | |
if (!err) { | |
console.log("updated"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.postnew = function (req, res){ | |
var entry; | |
console.log("POST: " + req.params + req.body + req.query); | |
entry = new regModel(); | |
for (key in req.body){ | |
entry[key] = req.body[key]; | |
} | |
entry.save(function (err) { | |
if (!err) { | |
console.log("created"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require( 'mongoose' ); | |
var regModel = mongoose.model( 'Model_name'); | |
exports.getAll = function (req, res){ | |
regModel.find(function (err, entries) { | |
if (!err) { | |
res.render( 'index', { | |
title : 'RestAPI System with Mongoose and Node/Express', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require( 'mongoose' ); | |
var Schema = mongoose.Schema; | |
var Model = new Schema({ | |
name : String, | |
surname : String, | |
age : Number | |
}); | |
var regModel = mongoose.model( 'Model_name', Model ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "application-name", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"start": "node app.js" | |
}, | |
"devDependencies": { | |
"nodemon" : "*", | |
"pm2" : "*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "application-name", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"start": "node app.js" | |
}, | |
"devDependencies": {}, | |
"dependencies": { | |
"express": "3.4.8", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sudo a2enmod rewrite | |
#sudo service apache2 restart | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################## | |
# modified version of original http://media-glass.es/ghost-sitemaps/ | |
# for ghost.centminmod.com | |
# http://ghost.centminmod.com/ghost-sitemap-generator/ | |
############################################## | |
url="TU_DOMINIO" | |
webroot='/var/www/ghost' | |
path="${webroot}/sitemap.xml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Marco Antonio Pajares/Alvaro Lopez | |
# Year: 2012 | |
#Antes de nada actualizamos el sistema, prioritario para un sistema seguro. | |
echo "Antes de nada lo primero sería realizar la actualiación del sistema" | |
sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# author: Marco Antonio Pajares/Alvaro Lopez | |
# year: 2012 | |
sudo echo "Este script configura el firewall..." | |
sudo echo "Estado de las iptables previo a la configuracion:" | |
#sudo iptables -L |