rriegs / rriegs-wiki

A single-page, small-content wiki implemented in Elm.
MIT License
0 stars 0 forks source link

Implement a back end using Node.js and Micro #2

Closed rriegs closed 6 years ago

rriegs commented 6 years ago

This first cut of the back end will expose a REST API implementing wiki content storage via the file system. Each topic will be stored in its own file in the data directory. The following routes will be supported:

Created files may be topic content, images, or other embeddable data.

rriegs commented 6 years ago

The above commits implement the back end as described, but also permit PUT and DELETE to subdirectories of data (creating and removing enclosing directories as appropriate) and return reasonable status codes for various kinds of errors.

Some enhancements that could be made in the future are:

At present, URLs ending in slash result in errors because fs operations interpret these as paths to directories but expect only paths to files. It might be reasonable to strip the trailing slash or, alternately, to use the trailing slash to signal that a directory is expected (assuming the last bullet above is implemented).