Comments (3)
Adding my 2 cents, the micro-dev
-package might be redundant with the built-in live reload feature w/ Node 18.
Specifically, you can use the --watch
-flag to get an automated code reload on file changes.
Therefore, the following setup might be sufficient by leveraging the serve
-function from the lib. Ofc this only works when you opt-out of the micro
-command.
Node.js
18.12.1
package.json
{
"scripts": {
"dev": "node --watch index.js",
"start": "node index.js",
}
}
index.js
import 'dotenv/config';
import http from 'node:http';
import { send, serve } from 'micro';
const handler = async (req,res) => {
// ...
};
const server = new http.Server(serve(handler));
server.listen(Number(process.env.PORT) || 8080);
I'm using such a setup in production for a small endpoint to generate OG-images at runtime: https://github.com/flaming-codes/crane-app/tree/main/services/og-img-gen
from micro-dev.
Open to contributions 🙏
from micro-dev.
Open to contributions 🙏
Uno-reverse huh? 👀 Guess I'm tinkering with this then, feel free to assign me. 👍
from micro-dev.
Related Issues (20)
- Restore compatibility with micro@canary
- Update chokidar to v3 HOT 1
- Add cli arguments to documentation
- apollo-server-micro floods console with introspection logs HOT 3
- Provide an option to disable the auto copy to clipboard behaviour
- --ignore option not accepting glob HOT 1
- micro with next js restart every time on next compile
- micro-dev restarts on non-source code changes
- Yargs Parser Security Vulnerability
- Update all dependencies HOT 1
- Add ESLint and move to TypeScript
- print name of module file being used on startup.
- Purpose of SIGUSR2 signal? HOT 1
- Windows node debugger: SyntaxError: missing ) after argument list HOT 1
- micro-dev exits on error HOT 3
- error Command failed with exit code 140 HOT 1
- UnhandledPromiseRejectionWarning thrown when content-type is not sent HOT 1
- add to readme: how to use custom now.json files with now-env
- Disable console logging? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro-dev.