DEV Community

Jukka Paulin
Jukka Paulin

Posted on

Server writing adventures in Node

Fascinating. Stardate-who-knows what, but we're en route to writing a minimal server.

It'll (most likely) meet its days somewhere down the line, but it's important to get experiments done for now. Developing code has been that for as long as the collective memory of homo sapiens remembers; experiments, problems; and then the blissful flow! Some backing up - and new code again. That's what a commit is made of.

My server's mission is:

  • take in API requests (mobile clients, ie smartphone)
  • parse the request
  • find out whether "you" (server) has the data (a tuplet; two variables defines the target)
  • if Yes, render the result back to caller
  • if Not, make it known that the call could not yield the data

Resources are your naming convention for the objects contained within the server's knowledge. Resource naming can make or break how popular your API will be: logical and concise naming helps writing client code, a lot.

I was starting to writing a first endpoint, using 'express' as a base to build on. Then I started to really think about two things:

1) performance
2) error handling

I'll keep elucidating my server adventures in the next part. Happy coding!

Top comments (0)