annotate api/server/ui/absolute-path.js @ 213:2fad2931a5a6

Fix for [issue78] gemma back end broken for me since 213:3d0988d9f867 During unification of the two connection pool implementions forget to initialize the tokens -> connection mapping in the non-persistent case.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 23 Jul 2018 20:38:40 +0200
parents 9fcfccb18b16
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
169
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 /*
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 * getAbsoluteFSPath
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 * @return {string} When run in NodeJS env, returns the absolute path to the current directory
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 * When run outside of NodeJS, will return an error message
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 */
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 const getAbsoluteFSPath = function () {
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 // detect whether we are running in a browser or nodejs
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 if (typeof module !== "undefined" && module.exports) {
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 return require("path").resolve(__dirname)
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 }
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 throw new Error('getAbsoluteFSPath can only be called within a Nodejs environment');
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 }
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13
9fcfccb18b16 feat: Added draft version of API specification for server
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 module.exports = getAbsoluteFSPath