[Server] ☄️ Get path on a server where Meteor application is currently running
BSD-3-CLAUSE License
Get the path to currently running instance of Meteor application on a server.
Features:
Meteor.rootPath
— absolute path to programs/server
directory;Meteor.absolutePath
— absolute path to .meteor
directory.meteor add ostrio:meteor-root
const pathToFile = `${Meteor.rootPath}/directory/where/is/your/file.json`;
Returns absolute path to programs/server
directory of your compiled application, without trailing slash.
const pathToFile = `${Meteor.absolutePath}/.meteor/local/build/programs/server/directory/where/is/your/file.json`;
Returns absolute path to .meteor
directory of your compiled application, without trailing slash.
Note: Be aware of the path stored in Meteor.absolutePath
, it points to the location where Meteor application is running. It isn't guaranteed to be the same path as the path of your project. For example, running Meteor in test-mode will return a path from a temporary location where it's running.
# Default
meteor test-packages ./
# With custom port
meteor test-packages ./ --port 8888
# With local MongoDB and custom port
MONGO_URL="mongodb://127.0.0.1:27017/meteor-root-test" meteor test-packages ./ --port 8888