Micro is a minimalistic library for creating ultra-lightweight, asynchronous HTTP microservices. It's built around the `async`/`await` pattern, enabling developers to write concise and highly performant request handlers with minimal boilerplate. The current stable version is 10.0.1, which introduced ES Modules support and TypeScript conversion. While it doesn't adhere to a fixed release cadence, updates are released to maintain compatibility with newer Node.js versions and modern JavaScript features. Its core differentiators include a tiny codebase (approximately 260 lines of code), explicit dependency management without implicit middleware, and a design philosophy focused on standard HTTP interactions. It is specifically intended for use within containerized environments, and the project explicitly advises against its use in serverless platforms like Vercel, where platform-native helpers often provide similar or superior functionality.
npm install microVerified import paths — ran on the pinned version, not inferred.
Sets up a basic Micro service that responds to GET requests and parses JSON POST bodies.
Upgrade your Node.js environment to version 16.0.0 or higher.
Replace deprecated CLI arguments with `--listen <uri>`, e.g., `micro -l tcp://0.0.0.0:3000`.
For serverless deployments, utilize platform-specific helpers instead of Micro. For example, on Vercel, use `req.body` and `res.send()` directly.
Install `micro-dev` (`npm install --save-dev micro-dev`) and configure your `package.json` `dev` script to use it (e.g., `"dev": "micro-dev"`).
Ensure your project is configured for ES Modules (e.g., `"type": "module"` in `package.json`) if using `import` statements. Review import paths and named vs. default exports.
Ensure `micro` is installed and update your `tsconfig.json` to include `node_modules/@types` or use the correct `import` statement. For CommonJS, use `require('micro')`.If your project is CommonJS, stick to `module.exports` for your handler. If using `import` for helpers, ensure your `package.json` has `"type": "module"` and your files use `.mjs` or are transpiled correctly.
Either stop the conflicting process or specify a different port for Micro using `micro -l tcp://0.0.0.0:XXXX` where XXXX is an unused port.
Update your `start` scripts or CLI commands to use the `--listen (-l)` option, e.g., `"start": "micro -l tcp://0.0.0.0:3000"`.