简体   繁体   中英

How should I structure a Meteor project with external scripts?

I'm curious if anyone has developed a best practice for organizing Meteor applications that contain external shell scripts, or other back-end processes that happen outside of the node.js server code and the client side js code.

For instance, I have a meteor app that is structured like this:

project-name
  client
  lib
  models
  packages
  public
  server

I have a shell script that processes some external data sources, and a Python script that does some other heavy lifting. These all then help by inserting new data into the Mongo instance. Yes, I know that's a bit of a jumble, but so are the backend data systems. My question is should I put these sorts of projects within the meteor app folder, or should they live outside of the system? Just curious how others are structuring apps like this.

Option #1

project-name
  client
  ...
  server
    data-processor.sh
    other-utility.py

Option #2

project-name
  client
  ...
  private
    data-processor.sh
    other-utility.py

Option #3

bin
  data-processor.sh
  other-utility.py
meteor-project-name
  client
  ...
  private

You shouldn't put any non-meteor files inside your meteor project directory, all of those CAN be picked up by some package, even if standard meteor-platform packages don't recognize the extension. So putting them in the /server might cause problems in the future. The /private folder on the other hand is meant for resources used by your application, so placing the scripts there is unsemantic and inelegant.

To avoid moving those scripts outside of the project folder you can store them inside a hidden directory, that is any directory with name starting with a dot, ie /.scripts . Files placed there will not be picked up by Meteor application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM