Open node in form and map.
This commit is contained in:
parent
5b9d2e615b
commit
03083b819b
12 changed files with 80 additions and 19 deletions
server/resources
31
server/resources/frontendResource.js
Normal file
31
server/resources/frontendResource.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffng').factory('FrontendResource', function (
|
||||
Logger,
|
||||
Resources,
|
||||
ErrorTypes,
|
||||
fs
|
||||
) {
|
||||
var indexHtml = __dirname + '/../../client/index.html';
|
||||
|
||||
return {
|
||||
render: function (req, res) {
|
||||
var data = Resources.getData(req);
|
||||
|
||||
fs.readFile(indexHtml, 'utf8', function (err, body) {
|
||||
if (err) {
|
||||
Logger.tag('frontend').error('Could not read file: ', indexHtml, err);
|
||||
return Resources.error(res, {data: 'Internal error.', type: ErrorTypes.internalError});
|
||||
}
|
||||
|
||||
return Resources.successHtml(
|
||||
res,
|
||||
body.replace(
|
||||
/<body/,
|
||||
'<script>window.__nodeToken = \''+ data.token + '\';</script><body'
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue