
D Web Development
By :

The NoteStore
class is used to persist and retrieve notes. Because other applications may require this functionality, too, you want to provide it as a service. Starting with the implementation based on Redis from Chapter 5, Accessing a Database, you can extract the following interface and save it is as notestore.d
:
module notestore; struct Note { long id; string topic; string content; } interface NoteStore { Note[] getNotes(string name); long addNote(string name, Note note); }
The only change here is that addNote()
cannot have a ref Note
parameter. The reason is that the caller of the method lives in a different process that is possible on a different computer. Therefore, the Note struct of the caller cannot be changed.
The server and client both require this interface. You use a separate module for it.
Let's create the server side. The main difference from the previous implementations is that the implementation of the NoteStore...
Change the font size
Change margin width
Change background colour