It's ugly, but also a working POST which requires that name, lat, and lon be present on JSON payload. This makes it clear to me why TDD is smart.
The basic API has fallen into place. You can now GET /poles for all poles and POST /poles to create a new pole. Poles are simple: name, lat, lon. Those parameters must exist, but there is no validation yet on the values within. Further, the GET API doesn't return poles in GeoJSON yet.
Added the basics for a GET /create route to display the form to create new features.
I've created a simple form using jade to input name, lat, and lon. It successfully hits my POST /api/poles endpoint, but the Content-Type is not yet JSON.
Due to the pivot away from asset management, I've decided to rename the poles collection to the more general features.
When renaming poles to features, I neglected to rename the poles file as well. This is simply a rename.
Both cleaned and tightened up the code by including some tiny helper functions and ensuring that I don't commit to mongo if an error condition exists.
As function declarations can go anywhere, I find that moving them to the bottom of the file aids readability.
Added autofocus to the name text input.
I just learned that there is an input type for number, so I'm using that for lat and lon.
I learned a couple things: all values for form inputs are added if they have a name and x-www-form-urlencoded is the preferred way to send form data, even over JSON.
The final piece has fallen into place. I have a MongoLab-hosted MongoDB instance so that deploying to Nodejitsu should be able to hit that DB. Time to test it.