grunt-contrib-connect middleware redirect function. easy to use make fake api for front-end. This sample used yeoman generator gruntfile.
- download
redirect.js
to project root. - edit
Gruntfile.js
var redirect = require('./redirect');
(function($){ | |
var I18N = function(){}; | |
I18N.prototype.lng = function lng() { | |
return $('html').attr('lang').toUpperCase() || 'EN-US'; | |
}; | |
I18N.prototype.t = I18N.prototype.translate = function translate(key) { | |
if(!key) { | |
return this; |
# Load balancer configuration | |
upstream exampleApp { | |
# Directs to the process with least number of connections. | |
least_conn; | |
# One failed response will take a server out of circulation for 20 seconds. | |
server 127.0.0.1:10080 fail_timeout=20s; | |
#server 127.0.0.1:10081 fail_timeout=20s; | |
#server 127.0.0.1:10082 fail_timeout=20s; | |
#server 127.0.0.1:10083 fail_timeout=20s; |
/** | |
* Local environment settings | |
* | |
* While you're developing your app, this config file should include | |
* any settings specifically for your development computer (db passwords, etc.) | |
* When you're ready to deploy your app in production, you can use this file | |
* for configuration options on the server where it will be deployed. | |
* | |
* | |
* PLEASE NOTE: |
module.exports = { | |
host: process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1', | |
// port: process.env.PORT || 1337, | |
port: process.env.OPENSHIFT_NODEJS_PORT || 80, | |
// environment: process.env.NODE_ENV || 'development' | |
// environment: process.env.NODE_ENV || 'production' | |
environment: process.env.NODE_ENV || 'development' |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
<head> | |
<title>Untitled-1</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<style type="text/css" media="screen"> | |
html, body { height:100%; background-color: #ffffff;} | |
body { margin:0; padding:0; overflow:hidden; } | |
#flashContent { width:100%; height:100%; } | |
</style> |
/*timestamp and datacreate | |
don't forget to set validate columns to ONLY DATA_VALUES for datacreate and timstamp columns | |
Do not allow to enter not valid data! | |
I don't know how to do this inside the script.*/ | |
function onEdit(e) { | |
//########################## SETUP BEGIN ################################### | |
var dc = 'datacreate'; //set datacreate_column_header | |
var ts = 'timestamp'; //set timestamp_column_header | |
// var dc_fontcolor = '#808080'; //set font-color in HEX or CSS mode for datacreate column | |
// var ts_fontcolor = '#808080'; //set font-color in HEX or CSS mode for timestamp column |
fs = require('fs') | |
cheerio = require('cheerio') | |
staticFolder = 'static' | |
cssFolder = 'css' | |
cssRoot = __dirname + '/' + cssFolder | |
htmlFolder = 'views' | |
htmlRoot = __dirname + '/../application/' + htmlFolder |
fs = require('fs') | |
cheerio = require('cheerio') | |
staticFolder = 'static' | |
imgFolder = 'img' | |
cssFolder = 'css' | |
cssRoot = __dirname + '/' + cssFolder | |
htmlFolder = 'views' | |
htmlRoot = __dirname + '/../application/' + htmlFolder |