Micro API
Summary
Minimal routing layer for building JSON APIs with Zeit's Micro
Installation
yarn add micro micro-api
Usage
Declare your API's routes
// index.jsconst microApi = const handlers = const api = moduleexports = api
Define some micro-compatible handlers
// handlers.jsconst uuid = // In memory databaseconst foos = const createFoo = { // Build up the new item const newFoo = ...body id: // Add it to the database foos return newFoo} // Find and return by idconst showFoo = foos moduleexports = createFoo showFoo
Run
micro -p 3000 ./index.js
See Micro documentation for complete usage.