Running the solution
We built many components over the previous two chapters, and it is now time to see them all working together. This section contains everything you need in order to get all the items running, assuming you have the environment set up properly, as described at the beginning of the previous chapter. This section assumes you have a single folder that contains the four subfolders: api
, counter
, twittervotes
, and web
.
Assuming nothing is running, take the following steps (each step in its own terminal window):
In the top-level folder, start the
nsqlookupd
daemon:nsqlookupd
In the same directory, start the
nsqd
daemon:nsqd --lookupd-tcp-address=localhost:4160
Start the MongoDB daemon:
mongod
Navigate to the
counter
folder and build and run it:cd counter go build -o counter ./counter
Navigate to the
twittervotes
folder and build and run it. Ensure that you have the appropriate environment variables set; otherwise, you will see errors when you run the program:cd ../twittervotes...