Creating the User Service

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 ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.