lundi 25 avril 2016

How to scaffold for NativeScript services

I am proposing to do is to have a separate folder which will contain 'services'. This would be for calls out to various REST APIs. Below is the pattern I'm thinking of using. Does this break any conventions of NativeScript or is it even good practice? The services could be called from other folders within the app so I am trying to keep things DRY.

app.js // The main app file, loads /items/items_list/items_list.xml
          as first screen of the app.

/services
  /parts
     get_parts.js // Lets say this would be a http service, called from
                     either /items or /jobs, or even anywhere else
                     within the app.

/items
  /items_list
    item_list.css
    item_list.xml
    item_list.js
    ...
/jobs
  /jobs_list
    jobs_list.css
    jobs_list.xml
    jobs_list.js
    ...

The names are made up for the purposes of the question so hopefully it still makes sense.

Aucun commentaire:

Enregistrer un commentaire