What's the difference between Packages and Services?


#1

After making a couple Atom packages, I can’t say I have discovered any API or content in the tutorials that describes what a “service” is.

I made an NPM package to allow users to depend on other Atom packages, but it’s messy to require a 3rd-party module to enable this functionality.

I first heard about services when I raised this issue here, but I can’t find anything through some light googling, so it’s come to this.


#2

You can find out much more about the services API here:


#3

Ok, I can access services via atom.services.

So Service-Hub's API is detailed here I am guessing?


#4

Here’s the basic rundown for anyone else that’s curious.

A service is a method or set of methods inside of a package that another package can use to interact with the providing package. It essentially allows the developer to expose a public API to their package. It also defines the dependency relationship between two packages. A package cannot depend on another package outright, but it can depend on the services that another package provides. (I’m assuming this in essence means that if the user installs a package that consumes a service of a second package, then that second package would be installed as well. Someone please correct me if I’m wrong.)

As an example, let’s say that a user wanted to create an Auth package. The Auth package would list its versioned services through the package.json file. Another package could then specify through its package.json that it wanted to consume one of the Auth packages services.

That’s at least what I gleamed from the listed issue.


#5

Just getting back into developing Atom packages, and this is a helpful summary of Services.

There has been some work on service-hub since I’ve last touched this, but it still seems like the only interaction point for providing and consuming Services.

@zephraph
This seems to imply that package developers can build up libraries of Services, which is an interesting use-case that I’m not sure is being taken advantage of yet.

At least the docs describe services now.