forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Berkeley Martinez
authored and
Berkeley Martinez
committed
Jul 1, 2015
1 parent
c434342
commit 580e2e3
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var path = require('path'); | ||
var loopback = require('loopback'); | ||
var express = require('express'); | ||
|
||
var port = 1337; | ||
|
||
// this will listen to traffic on port 1337 | ||
// The purpose is to redirect any user who is direct to https | ||
// instead of http by mistake. Our nginx proxy server will listen | ||
// for https traffic and serve from this port on this server. | ||
// the view being send will have a short timeout and a redirect | ||
module.exports = function(loopbackApp) { | ||
var app = express(); | ||
app.set('view engine', 'jade'); | ||
// views in ../views' | ||
app.set('views', path.join(__dirname, '..')); | ||
|
||
// server static files | ||
app.use(loopback.static(path.join( | ||
__dirname, | ||
'../', | ||
'../public' | ||
))); | ||
|
||
// all traffic will be redirected on page load; | ||
app.use(function(req, res) { | ||
return res.render('views/redirect-https'); | ||
}); | ||
|
||
loopbackApp.once('started', function() { | ||
app.listen(port, function() { | ||
console.log('https redirect lisenting on port %s', port); | ||
}); | ||
}); | ||
}; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
script(src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js") | ||
script(src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/js/bootstrap.min.js") | ||
link(rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Lato:400|Inconsolata") | ||
link(rel='stylesheet', href='/bower_components/font-awesome/css/font-awesome.min.css') | ||
link(rel='stylesheet', href='/css/main.css') | ||
// End **REQUIRED** includes | ||
include meta | ||
title redirecting to | Free Code Camp | ||
meta(charset='utf-8') | ||
meta(http-equiv='X-UA-Compatible', content='IE=edge') | ||
meta(name='viewport', content='width=device-width, initial-scale=1.0') | ||
meta(name='csrf-token', content=_csrf) | ||
script. | ||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | ||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | ||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | ||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | ||
ga('create', 'UA-55446531-1', 'auto'); | ||
ga('require', 'displayfeatures'); | ||
ga('send', 'pageview'); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
doctype html | ||
html(lang='en') | ||
head | ||
include partials/small-head | ||
body.top-and-bottom-margins | ||
include partials/navbar | ||
.container | ||
.row | ||
.panel.panel-info | ||
p redirecting you... please wait... | ||
include partials/footer | ||
script. | ||
setTimeout(function() { | ||
window.location = 'http://freecodecamp.com' | ||
}, 500); |