Modern Full-Stack Development: Using TypeScript, React, Node.js, Webpack, and Docker Zammetti pdf download
Modern Full-Stack Development: Using TypeScript, React, Node.js, Webpack, and Docker Zammetti pdf download
https://textbookfull.com/product/modern-full-stack-development-
using-typescript-react-node-js-webpack-and-docker-zammetti/
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-
loucas/
https://textbookfull.com/product/full-stack-react-projects-
modern-web-development-using-react-16-node-express-and-
mongodb-2nd-edition-shama-hoque/
https://textbookfull.com/product/the-complete-developer-master-
the-full-stack-with-typescript-react-next-js-mongodb-and-
docker-1st-edition-martin-krause/
https://textbookfull.com/product/practical-react-native-build-
two-full-projects-and-one-full-game-using-react-native-1st-
edition-frank-zammetti/
React Architect Full Stack React App Development and
Serverless Deployment Frank Zickert
https://textbookfull.com/product/react-architect-full-stack-
react-app-development-and-serverless-deployment-frank-zickert/
https://textbookfull.com/product/mastering-full-stack-react-web-
development-1st-edition-tomasz-dyl/
https://textbookfull.com/product/pro-mern-stack-full-stack-web-
app-development-with-mongo-express-react-and-node-vasan-
subramanian/
https://textbookfull.com/product/pro-mern-stack-full-stack-web-
app-development-with-mongo-express-react-and-node-2nd-edition-
vasan-subramanian/
https://textbookfull.com/product/pro-mern-stack-full-stack-web-
app-development-with-mongo-express-react-and-node-1st-edition-
vasan-subramanian-auth/
Modern Full-Stack
Development
Using TypeScript, React, Node.js,
Webpack, and Docker
Frank Zammetti
Modern Full-Stack Development
Frank Zammetti
Pottstown, PA, USA
Acknowledgments��������������������������������������������������������������������������������������������������xix
Introduction������������������������������������������������������������������������������������������������������������xxi
v
Table of Contents
Updating Packages��������������������������������������������������������������������������������������������������� 28
Publishing/Unpublishing Packages��������������������������������������������������������������������������� 28
Node: Standard Modules������������������������������������������������������������������������������������������������ 29
File System (fs)��������������������������������������������������������������������������������������������������������� 30
HTTP and HTTPS (http and https)������������������������������������������������������������������������������ 32
OS (os)����������������������������������������������������������������������������������������������������������������������� 34
Path (path)����������������������������������������������������������������������������������������������������������������� 35
Process���������������������������������������������������������������������������������������������������������������������� 36
Query Strings (querystring)��������������������������������������������������������������������������������������� 37
URL (url)�������������������������������������������������������������������������������������������������������������������� 38
Utilities (util)�������������������������������������������������������������������������������������������������������������� 39
The Rest of the Cast�������������������������������������������������������������������������������������������������� 40
Summary������������������������������������������������������������������������������������������������������������������������ 42
vi
Table of Contents
Whither Props?��������������������������������������������������������������������������������������������������������������� 76
Default Props������������������������������������������������������������������������������������������������������������� 77
Typing Props�������������������������������������������������������������������������������������������������������������� 80
Component Lifecycle������������������������������������������������������������������������������������������������������ 83
Summary������������������������������������������������������������������������������������������������������������������������ 86
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
MessageView.tsx����������������������������������������������������������������������������������������������������� 275
WelcomeView.tsx���������������������������������������������������������������������������������������������������� 280
Suggested Exercises���������������������������������������������������������������������������������������������������� 280
Summary���������������������������������������������������������������������������������������������������������������������� 281
xi
Table of Contents
Chapter 12: Bringing the Dev Ship into Harbor: Docker��������������������������������������� 347
An Introduction to Containers and Containerization����������������������������������������������������� 347
The Star of the Show: Docker��������������������������������������������������������������������������������������� 349
Installing Docker���������������������������������������������������������������������������������������������������������� 350
Your First Container: “Hello, World!” of Course!����������������������������������������������������������� 352
xii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 367
xiii
About the Author
Frank Zammetti is an application architect for a major financial firm with nearly 25
years of professional experience (plus almost 15 years of nonprofessional experience
before that). He is an author of, including this one, 12 technical books for Apress.
Frank has also authored over two dozen certification exams for SHL as well as several
independent articles for various publications. He is also a fiction author (shameless plug:
look him up on Amazon if you like sci-fi) and a musician of some renown (and here,
“some” should be taken to mean very little). Frank has been married for 25 years (to the
same woman even!) and they have two children together.
xv
About the Technical Reviewer
Kenneth Fukizi is a software engineer, architect, and consultant with experience in
coding on different platforms internationally. Prior to dedicated software development,
he worked as a lecturer for a year and was then head of IT in different organizations.
He has domain experience working with technology for companies in a wide variety
of sectors. When he’s not working, he likes reading up on emerging technologies and
strives to be an active member of the software community.
xvii
Acknowledgments
I’d like to acknowledge the exceptional team at Apress for allowing me to write not one
but twelve books for them over the last decade or so. I’ve worked with so many great
people, and it’s virtually impossible not to forget someone in a list like this, but among
the crew for sure are Ami Knox, Arockia Rajan Dhurai, Beth Christmas, Dulcy Nirmala
Chellappa, Chris Mills, Christine Ricketts, Dominic Shakeshaft, Douglas Pundick, Frank
Parnell, Frank Pohlmann, Gary Cornell, Jill Balzano, Julie Miller, Katie Stence, Kelly
Gunther, Kelly Winquist, Kevin Shea, Kim Wimpsett, Kimberly van der Elst, Krishnan
Sathyamurthy, Laura Cheu, Laura Esterman, Leah Weissburg, Leonard Cuellar, Liz
Welch, Louise Corrigan, Marilyn Smith, Michelle Lowman, Nancy Chen, Nicole Faraclas,
Nirmal Selvaraj, Richard Dal Porto, Sharon Wilkey, Sofia Marchant, Stephanie Parker,
Steve Anglin, Tina Nielsen, and Tracy Brown Collins.
As I said, I’m sure I’ve forgotten someone, but rest assured it was not on purpose!
Thank you all for giving me a shot and allowing me to continue this journey. I most
definitely could not have done it alone and I thank you all, unreservedly!
xix
Introduction
You know, when I started learning how to program, it was a piece of cake!
You’d turn on the computer and be greeted by a nice little “Ready” prompt. You’d
start typing in some code (BASIC), and eventually, you’d type run, hit Enter, and watch
whatever it was you put in there spit back something (my first program was a man drawn
with various keyboard characters doing jumping jacks). You might save that program to a
cassette – yes, kids, a cassette! – and hand it to your friends if you wanted to share.
But that was it. It was just that easy.
Nowadays, though, the story is very different.
Writing even a trivial application now involves layers upon layers of abstractions and
complexities that you must mix together, like baking the world’s most complicated cake,
hoping it all works in the end. Then, should you want to distribute the technological
terror you’ve constructed (sorry, Aldearan), you’ve got even more challenges to
overcome.
How anyone learns to program from scratch these days, I’m not sure!
But I’m hoping to help there!
With this book, I’m going to look at the ingredients that go into baking a cake – err,
building an application – these days. To be sure, it won’t cover everything. And no one
recipe is necessarily the same anyway – there are lots of choices available to a developer
now. But I believe I’ve chosen the ones most commonly used to build modern full-stack
applications.
What exactly is a full-stack application anyway? Well, simply put, it’s an application
that includes both a front-end “client,” like a web site, and a back-end “server,” like, well,
a server! We’re talking about building an application that combines those two halves
into a coherent whole. Most application development these days is web-based in some
way (where “web” doesn’t have to mean something available on the public Internet, but
something built with web technologies like HTML, JavaScript, and CSS), so that’s what
we’re going to be doing in this book.
To do this, we’re going to use React, which is one of the most popular libraries for
building clients out there today. And we’ll use Node.js, which is a popular choice for
back-end development. We’re also going to use TypeScript, a language that enhances
xxi
Introduction
JavaScript on both sides of the fence to make our coding lives better. We’re going to
touch on several other tools that relate to all of this including Babel and Webpack. We’ll
talk about some strategies for connecting the client to the server including REST and
WebSockets. Finally, you’ll learn about packaging up applications using the very popular
Docker.
All this will be combined to build two full, real applications. This way, it’s not just
simple, contrived examples. No, it’ll be real code, practical solutions to real problems
encountered in building them, and real techniques for putting all these pieces together
and making sense of all this complexity.
In the end, you’ll have a solid foundation for building modern full-stack applications
that you can go forward with on your own to create greatness.
I mean it’ll never be as great as my guy doing jumping jacks written in BASIC and
loaded off a cassette, but you gotta have goals.
So let’s get to it. There’s work to be done, learning to be accomplished, and, I hope,
fun to be had!
xxii
CHAPTER 1
1
© Frank Zammetti 2020
F. Zammetti, Modern Full-Stack Development, https://doi.org/10.1007/978-1-4842-5738-8_1
Chapter 1 Server-Side Action: Node and NPM
2
Chapter 1 Server-Side Action: Node and NPM
Note In later chapters, you’ll see that Node isn’t specific to the server side of
the equation, and in fact, you don’t always build apps with Node; sometimes you
use it to install and execute tools for various purposes on your own development
machine. Hold on to that thought; we’ll be coming back to before long a few
chapters from now.
None of these technical details are especially important to use as a Node developer,
but the performance it yields is what makes it no wonder that so many significant players
and sites have adopted Node to one degree or another. These aren’t minor outfits we’re
talking about, we’re talking names you doubtless know, including DuckDuckGo, eBay,
LinkedIn, Microsoft, Netflix, PayPal, Walmart, and Yahoo, to name just a few examples.
These are large businesses that require top-tier performance, and Node can deliver on
that promise (again, with the caveat that you as the developer don’t mess things up,
because that’s always possible).
Node is a first-class runtime environment, meaning that you can do such things as
interacting with the local file system, access relational databases, call remote systems,
and much more. In the past, you’d have to use a “proper” runtime, such as Java or .Net
to do all this; JavaScript wasn’t a player in that space. With Node, this is no longer true. It
can compete not only on performance but also in terms of what capabilities it provides
to developers. If you can think of it, chances are you can do it with Node, and that wasn’t
always the case with JavaScript.
To be clear, Node isn’t in and of itself a server. You can’t just start up Node and
make HTTP requests to it from a web browser. It won’t do anything in response to your
requests by default. No, to use Node as a server, you must write some (straightforward
and concise, as you’ll see) code that then runs on the Node “runtime.” Yes, you effectively
write your own web server and app server, if you want to split hairs (or potentially FTP,
Telnet, or any other type of server you might wish to). That’s a very odd thing to do as
a developer – we usually apply the “don’t reinvent the wheel” mantra for stuff like that
and pull one of the hundreds of existing options off the shelf. Plus, writing such servers
sounds (and probably actually is) daunting to most developers, and for good reason! To
be sure, it absolutely would be if you tried to write a web server from scratch in many
other languages, especially if you want it to do more than just serve static content files.
But not with Node!
3
Chapter 1 Server-Side Action: Node and NPM
But remember, acting as a server is just one capability that Node provides as a
JavaScript runtime, and it can provide this functionality only if you, as a developer, feed it
the code it needs to do so! In fact, a great many developer tools, and other types of apps,
use Node as their runtime nowadays. Node really is all over the place!
Note As you’ll see, React, Webpack, and TypeScript, three things that are primary
focuses of this book (Docker being the outlier), use Node to run and/or to be
installed (well, NPM is used to install them if we’re being accurate, but we’ll get to
NPM in just a moment). These are tools, not servers, which is the main point: Node
is useful for much more than just creating servers!
Node allows you to use the same language and knowledge on both client and server,
something that was difficult to accomplish before. In fact, aside from Java and some
Microsoft technologies (see project Blazor, which seeks to do the same thing with C#,
if you’re curious), there never has really been an opportunity to do so until Node came
along. It’s a pretty compelling opportunity.
Another critical aspect of Node is a driving design goal of the project, which
is keeping its core functionality to an absolute minimum and providing extended
functionality by way of APIs (in the form of JavaScript modules) that you can pick and
choose from as needed. Node gets out of your way as much as possible and allows you
only to introduce the complexity you really need, when you need it. Node ships with an
extensive library of such modules, but each must be imported into your code, and then
there are literally thousands of other modules that you can bring in as needed, some of
which you’ll see as we progress throughout this book.
In addition to all of this, getting, installing, and running Node are trivial exercises,
regardless of your operating system preference. There are no complicated installs with
all sorts of dependencies to manage, nor is there a vast set of configuration files to mess
with before you can bring up a server and handle requests. It’s a five-minute exercise,
depending on the speed of your Internet connection and how fast you can type! There
is also no required tooling to work with Node. In fact, a simple text editor is enough, in
simplest terms (though that isn’t to say you won’t want a robust IDE with Node support
later, but at least for this book I won’t be assuming anything other than Notepad or some
equivalent text editor).
4
Chapter 1 Server-Side Action: Node and NPM
All of this makes working with Node so much more straightforward than many
competing options while providing you with top-notch performance and load handling
capabilities. Moreover, it does so with a consistent technological underpinning as that
which you develop your client applications.
That’s Node in a nutshell!
Next, let’s see about getting it onto your machine so that you can start playing with
some code together and we can look at Node in a little more depth.
Note If you aren’t a JavaScript expert, don’t worry, we won’t be getting too fancy.
Even when we get to the apps, I’ll consciously keep things as simple as possible. It
is expected that you have some experience with JavaScript though, but you don’t
need to be Brendan Eich or Doug Crockford (but if you have no experience with
TypeScript, that’s fine; we’ll start from square one with it later).
http://nodejs.org
That’s your one-stop shop for all things Node, beginning, right from the front page,
with downloading it, as you can see in Figure 1-1.
5
Chapter 1 Server-Side Action: Node and NPM
Figure 1-1. Node has a simple web site, but it gets the job done!
Usually, I would tell you to install the latest version available, but in this case, it might
be better to choose a long-term support (LTS) version, because they tend to be more
stable. However, it shouldn’t (he said, with fingers crossed) matter which you choose, for
the purposes of this book. For the record, however, I developed all the code using version
10.16.3, so if you encounter any problems, I would suggest choosing that version, which
you can get from the Other Downloads link and then the Previous Releases link (you’ll
be able to download any past version you like from there).
The download will install in whatever fashion is appropriate for your system, and
I leave this as an exercise for the reader. For example, on Windows, Node provides a
perfectly ordinary and straightforward installer that will walk you through the necessary
(and extremely simple) steps. On macOS X, a typical install wizard will do the same.
6
Chapter 1 Server-Side Action: Node and NPM
Once the install completes, you will be ready to play with Node. The installer should
have added the Node directory to your path. So, as a first simple test, go to a command
prompt or console prompt, type node, and press Enter. You should be greeted with a
> prompt. Node is now listening for your commands in interactive mode. To confirm,
type the following:
Press Enter, and you should be greeted with something like what you see in Figure 1-2
(platform differences excepted, I’m a Windows guy myself, unashamedly, so that’s where
the screenshots throughout this book will be from, perhaps with a few exceptions later).
Figure 1-2. The rather uppity (though technically accurate) first greeting, proving
Node is alive
If you find that this doesn’t work, please take a moment and ensure that Node is
indeed in your path. It will make things a lot easier going forward.
let a = 5;
let b = 3;
let c = a * b;
console.log(`${a} * ${b} = ${c}`);
7
Chapter 1 Server-Side Action: Node and NPM
To execute this file, assuming you are in the directory in which the file is located, you
simply must type this:
node test.js
Press Enter after that, and you should be greeted with an execution, such as the one
you see in Figure 1-3.
Figure 1-3. It ain’t much, but it’s a real program running with Node!
Clearly, this little bit of code is unexceptional, but it does demonstrate that Node can
execute plain old JavaScript just fine. It demonstrates that we’re dealing with at least the
ES2015 specification as well, being more specific, thanks to the use of let and template
literals (or string interpolation if you prefer). You can experiment a bit if you like, and you
will see that Node should run any basic JavaScript that you care to throw at it like this.
www.npmjs.com
You can visit it through a web browser and look through all the packages available,
which makes finding exactly what you need easy.
8
Chapter 1 Server-Side Action: Node and NPM
Using NPM is simple: it’s merely another command to run from a command
prompt, just like Node is. For example, let’s say you create a directory named
MyFirstNodeProject. In it, you execute the following:
Here, npm is the CLI program that is NPM itself, and install is one command you
can issue to it. Then, express is an argument to that command, and this is the general
form that most of your interactions with NPM will take.
Note Most NPM commands have a shorter form as well. For example, rather than
type install, you can just type i, and it will do the same thing. Consult the NPM
docs for these shortcuts, or be pedantic like your favorite author and always type it
long-form, err, for clarity or something!
If you execute that, you’ll find that a directory called node-modules has been created,
and inside it will be a lot of…well, a lot of stuff you typically don’t need to worry about
too much! In short, though, it’s all the code that makes up the Express module (which
doesn’t matter right now, but is a JavaScript module, or package if you prefer, which we’ll
be using in the MailBag app a few chapters hence… but we’ll get to that app in due time,
we’ve got a fair bit of ground to cover before then, so for now suffice it to say it’s one of
the two apps we’re going to be building with the technologies discussed over the first six
chapters), plus whatever modules Express itself depends on (and whatever they might
depend on, and so on). NPM takes care of fetching all those dependencies for you. You’ll
also notice a file named package-lock.json has been created, and for our purposes
here, you don’t need to worry about that except to know not to delete it as NPM needs it
to do its job.
When you use the install command like this, the modules you name are installed
in the current directory, and this is referred to as the local cache, or project cache. You
can also install the module into what’s called the global cache by adding an argument to
the command:
9
Chapter 1 Server-Side Action: Node and NPM
Now, Express will be installed in a location outside the current directory and will
be shared by all Node projects (or, more precisely, it will be available to all projects,
because, of course, a project won’t use a globally installed module unless you tell it to).
Most usually, you will want to install dependencies in the project cache so that different
projects can use different version of a given module than other projects (there is always a
single version of a given module in the global cache, if any are present at all).
npm ls
Like on a *nix system, ls is short for list, and that’s what it does: lists the installed
modules. What you’ll see is a textual tree that shows the modules and then the modules
they depend on. In other words, more will likely be shown than just the modules you
explicitly installed (some modules don’t have dependencies, but in the NPM ecosystem,
those tend to be the exception rather than the rule).
Tip One very helpful tip I can give is that if you want to see just the top-level
modules, whether in the global or local cache, you can add --depth=0 to the ls
command.
If you want to see what’s installed in global cache instead, you can do
npm -g ls
In fact, keep that -g option in mind because you can add that to most NPM
commands to differentiate between the local and global caches.
You can also update a given module:
Just provide the name of the module to update, and NPM will take care of it, updating
to the latest available version. If you don’t provide a package name, then NPM will dutifully
update all packages. And yes, you can drop a -g on it either way to target the global cache.
10
Chapter 1 Server-Side Action: Node and NPM
Execute that and NPM will wipe Express from the local cache, along with its transient
dependencies (so long as nothing else that remains that depends on them).
These few commands represent likely the majority of what you’ll need to interact
with NPM. I refer you to the NPM docs for other commands (and note that just typing
npm and hitting Enter at a command prompt will show you a list of available commands,
and you can then type npm help <command> to get information about each).
npm init
If you are following along, please make sure the directory you run this from is empty
(delete node_modules and package-lock.json if present, both of which will be described
later). This will trigger an interactive process that walks you through the creation of the
package.json file, something like you see in Figure 1-4.
11
Random documents with unrelated
content Scribd suggests to you:
occasionally with me. I have been doing—I am doing—all I can for
you."
Berwick's steady, angry gaze disconcerted his sister, but she was
mentally adroit, and determined not to fear him in his present mood.
For the first time since Mrs. Rebell's stay at Fletchings, dinner,
served in a blue and white octagon room which seemed to have
been designed to serve as background to Miss Berwick's fair, delicate
type of beauty, passed almost silently and rather dully. Berwick and
O'Flaherty, tired after their long day in the open air, scarcely spoke;
Mr. Daman alone seemed entirely at ease, and he babbled away
happily, trying to extract material for his recollections from Lord
Bosworth's better garnished memory.
Arabella led the way up to the music gallery, and there, very
soon, the two younger men joined them.
Then time had gone on, and Lord Bosworth's niece had remained
unmarried—wholly devoted, so said rumour, to her brother, but living
with her uncle instead of with James Berwick because of her filial
affection and gratitude to the older man. That O'Flaherty had known
not to be true, for no special tie bound Arabella to her uncle. The
arrangement was probably one of convenience on either side.
Then, with the passing of years, the barrister had become, as the
successful are apt to do, more indulgent, perhaps more
understanding, in his view of the other's character and ambitions.
Also nothing succeeds like success, and James Berwick had himself
by no means lagged behind. To O'Flaherty there had been nothing
untoward in Berwick's marriage. He had regarded it as one of those
strokes of amazing luck which seem to pursue certain men; and
though a trifling circumstance had made the barrister vividly aware
of the young politician's conditional tenure of his dead wife's fortune,
the man who had fought his way to eminence naturally regarded the
other as belonging to that class which seems in this country
sufficiently wealthy, with the garnered wealth of the past, to
consider the possession of a larger or of a lesser income as of
comparatively small account.
True, the shrewder half of O'Flaherty's mind warned him that Miss
Berwick's action in deliberately throwing her brother with so
charming a woman as Barbara was an odd, an almost unaccountable
move on her part. But there was no getting over the fact that she
was doing this, and most deliberately.
Well, all that money could do for Berwick had surely been
accomplished. The barrister, watching the two—this man and woman
wandering in a paradise of their own making—felt that Berwick was
indeed to be envied, even if he was on the eve of forfeiting the huge
income which had for so many years given him an almost unfair
prestige and power among his fellows. Still, now and again,—to-
night for instance, when he became aware that Berwick and Mrs.
Rebell had retreated together to the further end of the long, bare
room,—he wondered if Arabella was acting sentiently, if she really
wished her brother to marry again.
Mrs. Rebell and the man she called her friend stood together, half
concealed by the organ which gave the gallery its name. They were
practically alone, for the long room was only lighted by the candles
which threw a wavering light on Arabella's music-book. For the first
time since she had arrived at Fletchings, Barbara felt ill at ease with
her companion. Twice during dinner she had looked up and seen
Berwick's eyes fixed on her, or so she thought, coldly and accusingly.
What had she done? For what must she ask forgiveness?
"Where were you before dinner?" he said at last, in a low voice. "I
looked for you everywhere. I found you, and then you disappeared—
utterly! We were close to the Priory to-day, and I went in for a
moment, thinking you would like to have news of Madame
Sampiero. By the way, McGregor gave me some letters for you."
"Won't you read your letters?" Berwick was looking straight across
at her with a singular expression—was it of appeal or of command?
—in his eyes.
"Why should I—now?" But a moment later she changed her mind,
"Yes, of course I will; Mr. Boringdon may have sent some message
to my god-mother which ought to be seen to at once——" She
opened the note, glanced through it, then put it down on the ledge
of the prie-dieu.
Berwick had turned away while she read Boringdon's note, but
now he was again staring at her with those strange, appealing eyes
which seemed to shine in the dim light.
She looked round, still holding the letter in her hand, but they
were far from the fire—
Berwick's face became set. Ah! no, that should not be.
"Mrs. Rebell—?"
He had not called her so, to herself, since the drive back from
Halnakeham Castle, and she had not noticed his avoidance of her
name; but now, the formal mode of address fell strangely on her
ears.
"Yes?"
Very slowly, still looking at her, he at last took up the two letters.
Then, with a sudden movement, and without having looked at it, he
put Boringdon's back on the ledge of the prie-dieu. "No," he said
roughly, "not that one—I do not think he ought to write to you, but
no matter!" Barbara felt herself trembling. She was beginning to
understand. Berwick's hands fingered nervously the West Indian
letter; at last he held it out to her, still folded, in his hand. "Here it is
—take it—I won't read it!"
"Oh! but do," she said. "It is from Mr. Johnstone, saying that he
has received the money you so kindly arranged to send back for
me."
She shook her head, and Berwick, at last free to see the agony
and surrender in the face into which he was looking down, and to
which he suddenly felt his lips so near, was swept by an irresistible
rush and mingling of feelings—remorse and fierce relief, shame and
exultant joy.
The two walked down the gallery, towards O'Flaherty, who was
still standing by the wood fire, and Arabella, who was putting out
the candles with the rather disdainful thoroughness and care she
gave to small household matters. Lord Bosworth's servants were old,
like himself, and grew unmindful of their duties.
Berwick suddenly left Mrs. Rebell's side, but not till he had
reached the door did he turn round and say, "I am not coming
down, for I have work to do, so good-night!" A moment after, he
was gone, with no more formal leave-taking.
That night Barbara cried herself to sleep, but to her tears brought
no relief—rather an added shame for the weakness which made
them flow so bitterly. She felt overwhelmed by a great calamity—
face to face with a situation out of which she must herself, unaided,
find an issue.
She had asked so little of the shattered broken life which
remained to her—only quietude and the placid enjoyment of a
friendship which had come to her unsought, and in which there
could be no danger, whatever Madame Sampiero or Mrs. Turke
might think. Did not the feeling which bound her to James Berwick
enjoy the tacit approval of such a woman as was Arabella Berwick?
What else had made Miss Berwick say to her, as she had done, that
her brother could never marry? Surely the words had been uttered
with intention, to show Mrs. Rebell how desirable it was that he
should have—friends?
Till to-night, love, to Barbara Rebell, had borne but two faces.
The one, that of the radiant shadow-like figure, half cupid half angel,
of her childhood and girlhood, was he who had played his happy
part in the love affair of her father and mother, binding them the one
to the other as she, Barbara, had seen them bound. It was this love
—noble, selfless, unmaterial in its essence, or so she had thought—
that lighted up Madame Sampiero's face when she spoke, as she
sometimes did speak, in the same quivering breath, of Lord
Bosworth and her little Julia.
Love's other face, that which she shuddered to know existed, had
been revealed to her by Pedro Rebell. It was base, sensual, cunning,
volatile, inconstant in its very essence, and yet, as Barbara knew,
love after all—capable, for a fleeting moment, of ennobling those
under its influence. Such, for instance, was love as understood by
the coloured people, among whom she had spent these last years of
her life, and with whose elementary joys and sorrows she had
perforce sympathised.
Now, to-night, she realised that love could come in yet a third
guise—nay, for the first time she saw that perhaps this was the only
true love of them all, and that her first vision of the passion had
been but its shadow. Some such feeling as that which now, she felt
with terror, possessed her body as well as her soul, must have made
her mother cling as she had clung, in no joyless way, to sombre,
disgraced Richard Rebell.
The maid who brought in her cup of tea in the morning laid a
parcel down on Barbara's bed. It was a book wrapped in brown
paper, and fully addressed to her with the superscription:—
"Yours truly,
"James Berwick."
Some instinct made her wait till she was alone. Then, opening the
parcel, she saw that, with the volume of Jacobite songs Berwick had
indeed promised to give her, was a large envelope marked "private."
From it she drew out slowly some twenty sheets or more, closely
covered with the as yet unfamiliar writing of the man she loved. To
the end of her life Barbara could have repeated portions of this, her
first love letter, by heart, and yet, before going downstairs, she burnt
each separate sheet.
Over the last she hesitated. Indeed, she cut out the three words,
"my heart's darling." But the little gilt scissors had belonged to her
mother—how would her mother have judged what she was now
doing?—and the slip of paper went into the fire with the rest.
"He smarteth most who hides his smart
And sues for no compassion."
Raleigh.
"Would you mind taking me with you to church this morning? Miss
Berwick tells me that her uncle won't be shocked."
Barbara's whole soul was possessed with the desire of putting off
the meeting with Berwick. How could she greet him before his
sister? how could she behave as if last night—as if his soul-stirring,
ardent letter, had not been? Berwick had written, among a hundred
other contradictory things, "Everything shall go on as before. I will
school myself to be content with the least you can give me." But
even she knew that that was impossible, and she blessed the chance
which had now come to her of escaping for a few hours the
necessity of playing a part before Lord Bosworth and Arabella.
So absorbed was Barbara in her thoughts that she scarcely
noticed Mr. Daman, when she crossed him on the broad staircase on
her way to her room to get ready for her expedition. The old man,
however, had seen the light from a large window beat straight on
her absorbed face. For the first time Barbara reminded him of her
father, of Richard Rebell, and the reminiscence was not pleasing.
Pretty women, he said to himself rather crossly, should study their
looks; they owed it to those about them. They ought not to get up
too early in the morning and go racing upstairs! Why, it was now
only half-past nine, and Mrs. Rebell had evidently already
breakfasted. He himself was up at this unwonted hour because it
was Sunday, and on Sunday everything should be done to spare the
servants in a country house. Septimus Daman lived up to his own
moral code much more completely than many of those who
regarded him as a selfish old worldling could pretend to do. Still, he
did not like to be baulked of innocent pleasures, and not least
among them was that of having his tea poured out for him on
Sunday morning by a pretty woman.
"Yes, and I'm taking Mrs. Rebell with me." Septimus Daman's
vested interest in Barbara amused the barrister.
"No. The Rebell Case took place some years before I came to
London." It was not the first time Mr. Daman had asked the
question, but O'Flaherty answered very patiently, and even added—
also not for the first time—"She must have been an exceptionally
beautiful and charming woman."
"Not that I ever heard of. He's always been a sugar planter, a
descendant of a Rebell younger son who went out to the West
Indies to make his fortune a hundred years ago. Poor Barbara
Sampiero told me about it at the time of the marriage."
"She's not a widow. Whatever gave you such an idea?" The old
man shot a sudden shrewd look at the barrister; O'Flaherty's face
expressed surprise, yes, and profound annoyance. Dear, dear, this
was distinctly interesting!
Mr. Daman lowered his voice to a whisper, "Her husband's very
much alive, but he's signed, so Bosworth tells me, some kind of
document promising to leave her alone. Of course he keeps her
fortune, such as it is, for she was married before this act which
makes women, I understand, so very independent of their lords and
masters. But that's rather a good thing, for it takes away his only
reason for molesting her. Still, there'll be trouble with him, if, as I'm
told, Madame Sampiero intends to leave her well off. Good Lord,
what a business we all had with Napoleone Sampiero! He was a
regular leech. Strange, isn't it, that both these poor dear women—
each, observe, a Barbara Rebell—should make such a mess of their
lives? However, in this case there's no Bosworth to complicate
matters!"
O'Flaherty wheeled round, and looked hard at the old man, but
Septimus Daman had spoken with no after-thought in his mind. He
had come to the stage of life when old people are curiously
unobservant, or perhaps it should be said, no longer capable of
realising the proximity of passion.
O'Flaherty had seen a great deal of Mrs. Rebell; they had had
more than one long talk together. Never had he met a woman who
seemed to him more pure-minded in the very essence of her. And
yet—well, the Irishman had seen—as indeed who could help seeing,
save that self-centred and naif egoist, Septimus Daman?—that
Barbara loved Berwick. The sight of these two, so absorbed in one
another, had deeply moved the one who looked on, and quickened
his own feeling for Arabella into life.
And now O'Flaherty learned that all the time he had been thinking
these things, Mrs. Rebell was well aware that there could be nothing
permanent or avowable in her tie with Berwick; while Berwick, on his
side, was playing the most delightful and absorbing of the great
human games with dice so loaded that, come what might, he was
bound to win. The barrister told himself that he had indeed been
simple-minded to suppose that such a man as Arabella's brother
would sacrifice to love the wealth which gave him an absolute and
preeminent position among those he wished to lead. "A marriage of
true minds?"—an ugly look came over the plain, strong face of the
man sitting by Mrs. Rebell, and she, catching that look, wondered
what hateful thought, or sudden physical discomfort, had brought it
there.
But, when once he found himself kneeling in the humble little iron
chapel, long habit acted on Daniel O'Flaherty's mind, cleared it of
sordid images, made him think more charitable thoughts of the
woman who crouched rather than knelt by his side, in what seemed
a position of almost painful abasement. Poor Barbara Rebell!
Mingling with the prayers he knew by heart, and which were, after
all, one long supplication for mercy and forgiveness, came the slow
conviction that she might not be deserving of so much
condemnation as he had at first assumed. Perhaps she had come
here, with him, to-day, to be out of the way of temptation, and not,
as he had unkindly suspected, to satisfy an idle and not very healthy
curiosity.
Busy as he had been last night in the music gallery with thoughts
of his own self and Arabella, O'Flaherty had yet been aware that an
eager colloquy was going on by the organ. He had heard Berwick's
voice become urgent and imperious, and he had put down the other
man's rather dramatic disappearance, and Mrs. Rebell's extreme
quietude during the rest of the evening, to some lovers' quarrel
between these two, who up to that time had required no such
artificial stimulus to their passion. Perhaps what had taken place
between them had been more tragic, for Mrs. Rebell looked to-day
very unlike her gentle, composed self.
Barbara had risen from her knees, and sat apparently listening to
the little sermon. The expression of her face suddenly recalled to
Daniel O'Flaherty an evening in his life—that which had followed his
parting from Arabella Berwick. He had been taken by friends to the
play, and on leaving the theatre had found that his mind had
retained absolutely nothing of what had gone on before him on the
stage. Not to save his life could he have recalled a single scene, or
even the most telling of the speeches to which he had been listening
the last three hours. Doubtless he had then looked as Barbara
looked now; and a feeling of great concern and infinite pity took the
place of that which had filled his mind during the drive from
Fletchings. But this new-born charity did not extend to Berwick; for
him, O'Flaherty still felt nothing but condemnation.
They waited till the small congregation had streamed out, and
then walked slowly down the little aisle. "You don't look fit to walk
back. I expect I can easily get a carriage if you will wait a little
while."
She bent over and kissed her god-mother's hands. "How nice it is
to be home again!" and her voice trembled, "What, darling
Marraine? Was Lord Bosworth kind? Yes, indeed—more than good
and kind! I have been very happy—very, very happy!" and then she
turned away to hide the tears rushing to her eyes.
While waiting for Mrs. Rebell, Daniel O'Flaherty looked with great
interest at the splendid old house before which he was pacing up
and down. This, then, was Chancton Priory, the place belonging to
the woman who some said had made, and others said had marred,
Lord Bosworth's life.
Now, at last Mrs. Rebell was coming towards him from the porch;
he saw that she looked, if not happier, more at peace than she had
done before going into the Priory, yet her eyelids were swollen, and
if victorious she seemed one whose victory has cost her dear.
As she led the way down the broad grass drive, she began to talk
of indifferent matters, making what O'Flaherty felt was rather a
pitiful, and yet a gallant attempt to speak of things which might
interest him.
When she mentioned Berwick, the colour had flooded her face,
and O'Flaherty had looked away. "Oh yes, I've met Oliver
Boringdon," he said quickly, and to give her time to recover herself
he went on, "I remember him in the House. But I had the luck to get
in again, and he was thrown out, at the last General Election. The
two friends are an interesting contrast. I regard James Berwick as
the typical Parliament man; not so Mr. Boringdon, who is much more
the permanent official, the plodding civil servant—that was what he
was originally, you know—and Berwick did him a bad turn in taking
him away from that career and putting him into Parliament."
"But what," asked Barbara in a low voice, "do you exactly mean
by character?"
"That, then, was what Miss Berwick meant when she said he
could never marry." Barbara seemed to be speaking to herself, but
the words fell on O'Flaherty's ear with an unpleasing significance. His
mind made a sudden leap. Could Arabella be planning—oh! what a
horrible suspicion concerning the woman he had once loved! But it
came back again and again during the hour which followed. Had he
not himself thought Miss Berwick was doing all in her power to
throw her brother and Mrs. Rebell together?
He went on speaking, as if impelled to say what he really thought.
"Well, such a thing as that is enough to test a man's character. From
being a poor man, practically dependent on his uncle, Berwick
became the owner of almost unlimited money, to the possession of
which, however, was attached a clause which meant that in his case
none of the normal conditions of a man's life could be fulfilled—no
wife, no child, friendship with women perpetually open, as I know
Berwick's more than once has been, to misconstruction."
"Nay," he said, "I give you for the moment every right to say, to
ask, what you like! I have no wife, no child, no home, Mrs. Rebell,
because the woman I loved rejected me; and also because, though I
have tried to like other women, I have failed. You see, it was not
that I had made a mistake, such as men make every day, for she
loved me too—that makes all the difference. She was in a different
position to my own; I was very poor, and there was the further bar
of my religion, even of my nationality"—he spoke with a certain
difficulty. "At the time she acted as she thought best for both our
sakes. But, whatever my personal experiences or motives for
remaining unmarried may be, I have no doubt,—no doubt at all,—as
to the general question. To my mind, James Berwick's friends must
regret that he has never, apparently, been tempted to make the
great sacrifice; and for my part, I hope the day will come when he
will meet with a woman for whom he will think his fortune well lost,
whom he will long to make his wife in a sense that the poor creature
he married never was, and in whom he will see the future mother of
his children." He paused, then added in a low voice, "In no other tie
can such a man as he find permanent solace and satisfaction. If
report speaks truly, he has more than once tried an alternative
experiment."
After they had all seen Barbara off, after he had noted her very
quiet but determined rejection of Berwick's company on the way to
Chancton Priory, Daniel O'Flaherty was in no mood to go for the walk
to which Miss Berwick had been looking forward all that afternoon.
CHAPTER XVII.
"Look in my face: my name is Might-have-been,
And I am also called No-more, Too-late, Farewell."
During those days she went through every phase of feeling. She
learnt the lesson most human beings learn at some time of their
lives—how to listen without appearing to do so for the sounds
denoting arrival, how to hunger for the sound of a voice which to the
listener brings happiness, however indifferently these same accents
fall on the ears of others. She schooled herself not to flinch when
the days went by bringing no successor to that letter in which
Berwick had promised her so much more than she had ever asked of
him.
More than once the rough old fellow was strongly tempted to say
to her: "If you wish to make yourself ill, you are just going the way
to do it!" but Mrs. Rebell's determination to go on as usual, to allow
no one to divine the state of her mind, aroused his unwilling
admiration, nay more, his sympathy. He had known, so he told
himself, what it was to feel as Barbara felt now, but in his case
jealousy, an agony of jealousy, had been added to his other
torments, and shame too for the futility of it all.
Nine days after Barbara had left Fletchings she received a letter
from Berwick. It bore the London postmark, but was dated the
evening of the day they had parted,—of that day when she had
successfully eluded his desire, his determination, to see her alone.
With deep trouble and self-reproach she told herself that perhaps
she had been wrong in taking to flight—nay, more, that she had
surely owed Berwick an explanation. No wonder he was hurt and
angry! And he would never know, that was the pity of it, that it was
of herself she had been afraid—
Then those about her suddenly began to tell Mrs. Rebell that
which would have made such a difference before the arrival of
Berwick's letter. "I suppose you know that James Berwick is in
London? He was sent for suddenly," and Boringdon mentioned the
name of the statesman who had been Prime Minister when Berwick
held office.
And Boringdon had never told her this all-important fact! Barbara
felt a sudden secret resentment against the young man. So it had
lain with him to spare her those days of utter wretchedness; of
perpetually waiting for one whom she believed to be in the near
neighbourhood; nay more, those moments of sick anxiety, for at
times she had feared that Berwick might be ill, physically unable to
leave Fletchings or Chillingworth. But this most unreasonable
resentment against Oliver she kept in her own heart.
The next to speak to her of Berwick had been Mrs. Turke. "So our
Mr. Berwick's in London? But he'll be back soon, for he hasn't taken
Dean with him. Sometimes months go by without our seeing the
dear lad, and then all in a minute he's here again. That's the way
with gentlemen; you never know when you have 'em!" And she had
given Barbara a quick, meaning look, as if the remark had a double
application.
Then came a day, the 8th of December, which Mrs. Rebell became
aware was not like other days. For the first time since she had been
at the Priory Madame Sampiero inquired as to the day of the month.
Doctor McKirdy was more odd, more abrupt even than usual, and
she saw him turn Boringdon unceremoniously from the door with the
snarling intimation that Madame Sampiero did not wish to-day to be
troubled with business matters. Mrs. Turke also was more
mysterious, less talkative than usual; she went about her own
quarters sighing and muttering to herself.
Still, when at last, late in the morning, she was sent for by Doctor
McKirdy, and informed curtly that someone was waiting for her in
the grass walk, she made no doubt of who it could be. In her
passion of relief, in her desire to bear herself well, to return, if it
might be possible, to the old ideal terms on which she and Berwick
had been before he had been seized with what she to herself now
characterised as a passing madness, Barbara hardly noticed how
moved, how unlike himself the old Scotchman seemed to be, and
how, again and again, he opened his lips as if to tell her something
which native prudence thrust back into his heart.
So great, so overwhelming was Barbara's disappointment when
she saw that the man leaning on the iron gate leading to the now
leafless rosery was Lord Bosworth, and not James Berwick, that she
had much ado to prevent herself from bursting into tears. But she
saw the massive figure before she herself was seen, and so was able
to make a determined effort to conceal both her bitter deception,
and also her great surprise at finding him there.
"As you are doubtless aware," Lord Bosworth began abruptly, "I
come here three or four times a year, and McKirdy is good enough to
arrange that on those occasions I can visit my child's grave without
fear of interruption. I ventured to ask that you might be told that I
wished to see you here, because I have a request to make you—"
He hesitated, and with eyes cast down began tracing with the
heavy stick he bore in his hand imaginary geometrical patterns on
the turf.
"If my daughter Julia had lived, she would have been seventeen
to-day, and so it seemed to me—perhaps I was wrong—to be a good
opportunity to make another effort to soften Barbara's heart." He
put his hand on Mrs. Rebell's shoulder, and smiled rather strangely
as he quickly added, "You understand? I mean my own poor
Barbara's heart, not that of this kind young Barbara, who I am
hoping will intercede for me, on whom I am counting to help me in
this matter. I do not know how far I should be justified in letting her
know what is undoubtedly the truth, namely, that I have not very
long to live. McKirdy absolutely refuses to tell her; but perhaps, if
she knew this fact, it would alter her feeling, and make her more
willing to consider the question of—of—our marriage."
"You are surely not going to walk back all the way alone!" she
cried, for she saw with emotion that he looked older even in the few
days which had elapsed since he had bade her good-bye at
Fletchings.
Barbara kept her own counsel, but she could not resist the
question, "Then he comes often?"
"I think he has a right," she said in a low tone—then with more
courage, "Of course he has a right, Doctor McKirdy! I'm sure if my
god-mother could see Lord Bosworth, could hear him——" her voice
broke, and she bit her lip, sorry at having said so much.
But the interview with Madame Sampiero's old friend, and the
little encounters with Doctor McKirdy, did Barbara good. They forced
her to think of something else than of herself, of another man than
James Berwick; and at last she made up her mind that she would
tell her god-mother she wished to speak to her without this dread of
constant, futile interruption. At once her wish was granted, for the
paralysed mistress of the Priory could always ensure privacy when
she chose.
But, alas for Barbara, the result of the painful talk was not what
she had perhaps been vain enough to think herself capable of
achieving on behalf of Lord Bosworth: indeed, for a moment she had
been really frightened, on the point of calling Doctor McKirdy, so
terrible, so physically injurious had been Madame Sampiero's
agitation.
"I cannot see him! He must not see me in this state—he should
not ask it of me." Such, Mrs. Rebell had divined, were the words her
god-mother struggled over and over again to utter. "Marriage?"—a
lightning flash of horror, revolt, bitter sarcasm, had illumined for a
moment the paralysed woman's face. Then, softening, she had
added words signifying that she was not angry, that she forgave—
Barbara!
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com