2 From little things, big things grow: Building the Photosphere backend

 

In this chapter, you will learn

  • Starting a new project
  • Making progress and taking feedback through small and simple steps
  • Using live reload to minimize the distance between coding and feedback
  • Building and testing a REST API with Node.js and JavaScript
  • Reviewing and committing your code with Git

How do we start a new project? How do we continue a current project?

Starting a project or just trying to figure out what to do next means asking this question:

What’s the next simplest thing I can do to move forward?

We are working towards a complex application and the journey there might be difficult, but each step along the way should be simple. We make progress in development by breaking a larger, more complex job into small increments of work and taking feedback along the way. But we can’t always know ahead of time what those steps will be. So for each step forward we must start with this question: what's the simplest next thing we can do to continue making progress?

In this chapter we build the Photosphere monolithic backend through small chunks of work, giving many opportunities to gather feedback and reassess what we are doing. Our main goal is code that is working, reliable and valuable. So after each iteration of coding we will be testing our changes to keep our code working (section 1.7.3), reviewing our work and capturing our working code into version control. Strap in, coding is imminent.

2.1 Getting the code and seeing the result of this chapter

2.2 The beating drum of development

2.3 Think before coding

2.4 Bootstrapping the backend

2.5 Live reload for fast feedback

2.6 The world’s simplest web server

2.7 Uploading an asset

2.8 Testing a REST API

2.9 Retrieving an asset

2.10 Improving our test script

2.11 Configuring the backend

2.11.1 Reading the port number from an environment variable

2.11.2 Setting the environment variable manually

2.11.3 Setting the environment variable automatically

2.12 Adding a database

2.12.1 Instant database: just add water

2.12.2 Changes for asynchronous setup

2.12.3 Connecting to the database

2.12.4 Revising our test script

2.12.5 Storing asset details in the database

2.13 Retrieving a list of assets

2.14 The most important way to improve as a developer

2.15 Put working code in the bank

2.16 Our work is not done

2.17 Continue your learning

2.18 Summary