February 2018
Intermediate to advanced
456 pages
9h 56m
English
In the last chapter, we simply had two services in the same module, which is fine for any small-scale project. However, now that our platform is starting to grow and new roles are being defined between services, let's start to split these out by keeping them in different modules. Alongside your service.py, create a new file, user_service.py.
Add the following code:
from nameko.rpc import rpc
from .dependencies.users import UserStore
class UserService:
name = 'user_service'
user_store = UserStore()
@rpc
def create_user(self, first_name, last_name, email, password):
self.user_store.create(
first_name=first_name,
last_name=last_name,
email=email,
password=password,
)
If you read the last chapter, then there is nothing ...