Closed nkhil closed 3 years ago
I ran into this as well, found this older issue. I think the readme you're using doesn't match the version you have installed. If you look at https://www.npmjs.com/package/micro, calling micro should return a server instance that you can call listen on:
const micro = require('micro')
const sleep = require('then-sleep')
const server = micro(async (req, res) => {
await sleep(500)
return 'Hello world'
})
server.listen(3000)
While trying to understand a legacy codebase, I came across
micro
.While trying to grok micro, I tried using the following example:
as well as
However, trying to cURL the
http://localhost:3000
endpoint via my terminal (and postman), my request hangs.I'm probably doing something wrong, but I don't have any feedback or error messages to indicate how I can get micro to work.
If I get micro to work, I'll create a PR to update the quick start examples in the readme.