TODO - pcimino/nodejs-restify-mongodb GitHub Wiki
TODO
Coding TODOs
There are a number of places where I still need to expand my knowledge of Nodejs and functional programming. You'll see TODOs sprinkled throughout the code.
For example I had some issues with REST API behavior.
Versioning
Restify supports versioning in the header so you can rollout new APIs like this:
apt.get({path: '/api/user:id', version: '1.0.0'}, getUser_V1);
apt.get({path: '/api/user:id', version: '2.0.0'}, getUser_V2);
However this seems to break the static server. Not critical, but for this project serving static content is a nice to have. So for now I'm using the explicit URI versioning scheme
`apt.get('/api/v1/user:id', getUser_V1);`
`apt.get('/api/v2/user:id', getUser_V2);`
URI parameter enforcement (or whatever it's called) where the URI includes the required parameter.
`apt.get('/api/v1/user:id', getUserByUserId);`
`apt.get('/api/v1/user:username', getUserByUsername);`
This seemed to work for a while. If the client tried to access
`localhost/api/user`
instead of
`localhost/api/user?username=somename`
The client received a 404. I'd prefer the client got a message, which I implemented. But this is not why I changed back to manually parsing the search parameters. For some reason I still need to investigate, I started getting 405's instead of successful responses, and I'm not even sure what I did to break it.
Module TODOs
- Authentication: Started the project with an auth anywhere implementation but got bogged down with it. need to revisit
- Bunyan logging, nota big deal, not sure I need it yet
- Authenticate the socket and make it do something useful
Design TODOs
I would like to capture ideas and future considerations for using this project to actually deploy a robust commercial application:
- MongoDB Clustering
- Putting the database in a Virtual Private Cloud (VPC)
- Using a scalable Nodejs cluster
- Load balancing
- ???
Next: Nodejs Server Setup
Return Home