From: Girish Ramakrishnan Date: Sat, 28 Nov 2015 00:36:57 +0000 (-0800) Subject: use APP_ORIGIN instead of HOSTNAME X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=5c6f8c0a837a09bc876c9705c0941888cdf3a4f6;p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git use APP_ORIGIN instead of HOSTNAME --- diff --git a/app.js b/app.js index b1f2675..4570b07 100755 --- a/app.js +++ b/app.js @@ -29,7 +29,7 @@ router.put ('/api/files/*', auth.ldap, multipart, files.put); router.delete('/api/files/*', auth.ldap, files.del); // welcome screen in case / does not serve up any file yet -var appUrl = process.env.HOSTNAME ? 'https://' + process.env.HOSTNAME : 'http://localhost:3000'; +var appUrl = process.env.APP_ORIGIN ? process.env.APP_ORIGIN : 'http://localhost:3000'; router.get('/', function (req, res) { res.status(200).send(ejs.render(fs.readFileSync(path.join(__dirname, '/app/welcome.html'), 'utf8'), { appUrl: appUrl })); }); app.use(morgan('dev')); @@ -54,4 +54,4 @@ var server = app.listen(3000, function () { console.log('Surfer listening at http://%s:%s', host, port); console.log('Using base path', basePath); -}); \ No newline at end of file +});