Giter Club home page Giter Club logo

micro-dev's Introduction

Micro (Dev) β€” Asynchronous HTTP microservices

This command line interface provides a belt full of tools that make building microservices using micro a breeze! It's only meant to be used in development, not in production (that's where micro comes in).

Features

  • Hot Reloading: When making changes to your code, the server will restart by itself
  • Logs: Incoming and outgoing requests will be logged to stdout
  • Beautiful JSON: When JSON bodies are logged, they're styled and prettified
  • Clipboard Support: The local address is pasted to the clipboard automatically
  • Port Selection: Automatic detection and use of an open port (if the specified one is in use)
  • Debug in Your Network: The network address shown in addition to local one
  • Duration Logs: Calculates and shows the duration for each request
  • Pretty Errors: Prettifies the Error object if any exceptions are thrown

Usage

Important: This tool is only meant to be used in development. In production, you should use micro, which is much lighter and faster (and also comes without the belt of tools used when developing microservices).

When preparing your development environment, firstly install micro-dev:

npm install --save-dev micro-dev

Note: You'll need at least Node.js v7.6.0 to run micro-dev.

Next, add a new script property below micro inside package.json:

"scripts": {
  "start": "micro",
  "dev": "micro-dev"
}

As the final step, start the development server like this:

npm run dev

Debugging

The package can be used in conjunction with the Node.js inspector like this:

"scripts": {
  "inspect": "node --inspect node_modules/.bin/micro-dev"
}

As the final step, start the development server like this:

npm run inspect

Contributing

  1. Fork this repository to your own GitHub account and then clone it to your local device
  2. Move into the directory of the clone: cd micro-dev
  3. Link it to the global module directory of Node.js: npm link

Inside the project where you want to test your clone of the package, you can now either use npm link micro-dev to link the cloned source to your project's local dependencies or run micro-dev right in your terminal.

Authors

micro-dev's People

Contributors

anatoo avatar azz avatar bakpakin avatar bartdeslagmulder avatar brikou avatar dotcypress avatar floatdrop avatar fmiras avatar kandros avatar leerob avatar leo avatar lukeed avatar paulogdm avatar possibilities avatar ramiel avatar randallsquared avatar rapzo avatar sbrichardson avatar sijad avatar sramam avatar thinkverse avatar timneutkens avatar trotzig avatar tungv avatar zertz avatar zigomir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micro-dev's Issues

Error: listen EAFNOSUPPORT

When run micro-dev -p 8080, error will come out:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EAFNOSUPPORT :::8080
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1350:19)
    at listenInCluster (net.js:1408:12)
    at doListen (net.js:1517:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

But micro -p 8081 is fine.

Enable passing flags to Node

It should be possible to send flags directly to Node.js, which would enable --inspect, --experimental-modules and other such essential flags to be used in development.

Dependencies need updating

[!] 12 vulnerabilities found
    Severity: 2 low | 8 moderate | 2 high

Saw this when updating modules in my microservice.

Port disappear at restart when automatic port mapping

when tcp 3000 is already used, micro-dev start using a ephemeral port.
but, when i changed js, that port disappeared.
i think micro-dev restart another ephemeral port at this time.
i want micro-dev to use the same port.

Trying to open unclosed connection.

I'm using Mongoose for my server, and when micro-dev restarts it doesn't close the connection nicely so I get an error:

How would I tell micro-dev to close the connection prior to restart?

File changed: src/router/user.js - Restarting server...
{ Error: Trying to open unclosed connection.
    at NativeConnection.Connection._handleOpenArgs (/micro-authentication-starter/node_modules/mongoose/lib/connection.js:214:11)
...
}

Can we send POST requests?

Whenever I try post request to my localhost:3000 with micro-dev I'm getting following message:

JSON body could not be parsed: Invalid body

Is this lib meant for such things at all?

micro-dev and .mjs "experimental-modules"

I'm trying to get micro-dev working with my .mjs files.

I tried the proposed solution in this closed issue but it throws an error and I'm unsure of a workaround.

"dev": "node --experimental-modules node_modules/.bin/micro-dev index.mjs"

Produces the following error:

micro: Error when importing
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module

hot reloading too fast

I'm using webstorm 2017.2.1 and when I change focus from the editor to my browser i guess my .idea/workspace.xml gets changed causing node to stop because the port is in use (i'm using port 30100). Is there a way I can exclude certain directories from being watched by the hot reloader?

This is the console after i save index.js and change window focus over to my browser:

File changed: index.js - Restarting server...

File changed: .idea/workspace.xml - Restarting server...

File changed: .idea/workspace.xml - Restarting server...
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::30100
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at Server.setupListenHandle [as _listen2] (net.js:1305:14)
    at listenInCluster (net.js:1353:12)
    at doListen (net.js:1479:7)
    at _combinedTickCallback (internal/process/next_tick.js:105:11)
    at process._tickCallback (internal/process/next_tick.js:161:9)

Ignore flag not working correctly

This is very annoying. My IDE puts a .idea file in the project, which is in my gitignore. micro-dev does not seem to respect the --ignore flag. I have tried:

--ignore=.idea/

--ignore=.idea/*

--ignore=**/*.xml

--ignore=*.xml

And all other kinds of patterns. Unfortunately combined with #55 it makes micro-dev pretty unusable right now :'(

micro as a peerDependency

Hi everyone, how are you?

What do you think about define micro as a peerDependency?

For example, in my case I'm using micro 8.0.4 in production but when I run micro-dev I have two differents intances of micro working on (8.0.4 and 8.0.2) because how NPM resolve my dependencies.

This is a problem when micro uses some kind of internal state behaviour like this one: https://github.com/zeit/micro/blob/master/lib/index.js#L114

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Buffer doesn't work

At least in the way I'm attempting to do it. I'm working on a microservice to do image conversion.

async function convertWebp(data) {
  // data.blob.headers["content-type"] = "application/octet-stream";
  const buf = await buffer(data.blob, { limit: "5mb" });

  imagemin(buf, "build/images", {
    use: [
      imageminWebp({ quality: 80 })
    ]
  }).then(files => {
    log(files);
  });
}

The error I get in the console is:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 21): TypeError: Cannot read property 'content-type' of undefined

As you can see in the comment I left in my code, I tried adding headers but I assume I'm not doing this right. Does anyone have any insight into what I'm doing wrong?

Windows node debugger: SyntaxError: missing ) after argument list

I have an npm script like follows, trying to use node debugger support.

"scripts": {
    "debug": "node --inspect ./node_modules/.bin/micro-dev"   
  }

If I run npm run debug on WINDOWS I always get something like this:

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:588:28)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Is this a windows issue?

Can't console.log

The output of console.log is not printed.
I can only see the incoming requests.

Yes, I still use console.log to debug. Don't you? :-)

Hot reloading not reliable

Hi! First thanks for this rally fine separation of micro and micro-dev, I think it's neat!

Now while using mico-dev it happens to me pretty often that it won't pick up file changes. (I'm using node v8.3.0 on latest macOS).

Usually first file changes are recognized and server is restarted but after a while it just stops re-starting.

Simplest way to reproduce I found up until now is to open index.js file in any editor and just keep saving it (or just hold down cmd + s for few seconds). After few saves micro-dev will stop restarting a server. (It happens also when normally editing code and saving).

package.json

{
  "name": "micro-dev-restart-issue",
  "main": "index.js",
  "scripts": {
    "dev": "micro-dev"
  },
  "devDependencies": {
    "micro-dev": "^1.2.0"
  }
}

index.js

exports.default = (req, res) => {
  res.end('hey')
}

Cannot terminate with hot reloading

Hello πŸ‘‹

I've just been experimenting with micro-dev. If I use micro-dev hot reloading is enabled by default, which is awesome. However if I ctrl+c the process it continues to run (and print output) in the background, which is quite annoying.

I am on the latest MacOS.

Use on node < 8?

The way this is constructed, it can only be used on node v8+ since it is not transpiled and uses async/await. Are there any plans to transpile this module so we can use it on node < v8?

Graceful shutdown on SIGTERM

It's great that micro core now handles SIGTERM, and it would be even better if micro-dev did as well. Better yet if both micro and micro-dev handled SIGINT too to gracefully shut down 😎

Doesn't restart on crash/Unhandled Exception

micro-dev is really awesome some for. Love the attention to detail you put into it and the hot reloading is ace. There is one thing that is bugging me though and that is that the server is never restarted upon receiving an unhandled exception.

While developing and encountering an error, I was initially confused why the server didn't accept any new connections anymore.

To fix that I made a small wrapper that acts as a supervising process that can restart the child process (micro-dev) automatically in such cases. Would love if this feature would be built-in.

Error on reload

I've installed the bare minimum micro and micro-dev

When I run micro-dev and change the code and save I get an error.

module.js:487
    throw err;
    ^

Error: Cannot find module '/Users/leon/Labs/micro-test/node_modules'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.resolve (internal/module.js:18:19)
    at Object.restartServer (/Users/leon/Labs/micro-test/node_modules/micro-dev/lib/listening.js:43:30)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:105:13)
    at Server.emit (events.js:207:7)
    at emitCloseNT (net.js:1647:8)
    at _combinedTickCallback (internal/process/next_tick.js:135:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

It's when listening.js tries to remove the require cache that it fails.

// Remove file that changed from the `require` cache
  for (const item of toDelete) {
    const location = require.resolve(item)
    delete require.cache[location]
  }

The three items I'm getting:

item /Users/leon/Labs/micro-test
item /Users/leon/Labs/micro-test/index.js
item /Users/leon/Labs/micro-test/node_modules

What could be wrong?

cwd is always watched for reload although path is passed

I was expecting that launching micro-dev api will only watch 'api' folder but it is reloading after any file on my project changes, also outside api folder.

I have solved that using --ignore flag but I find the behavior that I expected more rational.

Add options for explicitly including/excluding what to watch on restart

So I'm trying out micro-dev on an existing project, and I don't have a way to ignore changes in files that don't have to do with micro. The error comes from:

  /* listening.js, Line 42 */
  // Remove file that changed from the `require` cache
  for (const item of toDelete) {
    const location = require.resolve(item)
    delete require.cache[location]
  }

Cannot find module <insert existing js files here>. I know this is a minimalist library, but it would be nice to at least be able to specify a single file to run and watch. It looks like the watch gets directories here:

  /* listening.js, Line 74 */
  const closestPkg = await pkgUp(path.dirname(file))
  const toWatch = closestPkg ? path.dirname(closestPkg) : process.cwd()

So if there was another cli arg (--watch?) that got passed as toWatch, possibly with some glob magic, I think that would work for my use case. Let me know if I missed any details! Awesome lib!

PUT with non-JSON body emits spurious error

Issuing

$.ajax({
    type: 'PUT',
    url: '/data/abc',
    contentType: 'text/plain',
    data: 'some plain text'
})

results in

> #12 PUT /data/abc

JSON body could not be parsed: Invalid JSON

< #12 200 [+3ms]

If one instead uses data: '"quoted text"', the result is:

> #13 PUT /data/abc

"quoted text"

< #13 200 [+18ms]

and similarly for {"other": "valid JSON"} strings. Note this occurs even if setting contentType: 'text/plain', as shown. The error is purely cosmetic: other operation proceeds as normal. The behavior may have been introduced in #35 in response to #33.

I also note that GET requests print their response data if it is formatted as valid JSON, but otherwise print nothing without error, i.e. they must be checking whether the response is JSON-parsable before attempting to do so. (Actually, it looks like the real distinction is that non-JSON request payloads always cause the error, while response payloads check as appropriate.)

Make Hot Reloading optional

First, thanks for this great tool, and congratulations for the release, the upgrade was a snap.

The only problem I have is with hot reloading for a couple of reasons. First, I use micro to write/remove a lot of temp files, and second, I use it with websocket connections.

This mean that my app keep crashing or hanging connections in development.
It would be great if you could make it optional.

Thanks!

POST and PUT do not log response to console

After upgrading from 1.1.2 to 1.2.2, POST and PUT responses are no longer getting logged to the console. I am seeing responses received by the client.

> #7 PUT /user/name                                                  2:18:34 PM


β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
> #2 POST /                                                          2:22:14 PM


β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

Is anyone else experiencing this?

ignore option is not working

Am I misunderstanding how to use it? Or is this function at development stage?

$ micro-dev -i ./.idea

   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚                                                     β”‚
   β”‚   Micro is running!                                 β”‚
   β”‚                                                     β”‚
   β”‚   β€’ Local:            http://localhost:3000         β”‚
   β”‚   β€’ On Your Network:  http://xxx.xxx.xxx.xxx:3000   β”‚
   β”‚                                                     β”‚
   β”‚   Copied local address to clipboard!                β”‚
   β”‚                                                     β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


File changed: .idea/workspace.xml - Restarting server...
Restarted!

File changed: .idea/workspace.xml - Restarting server...
Restarted!

File changed: .idea/workspace.xml - Restarting server...
Restarted!

ENV vars support

I'm a huge fan of having a .env file locally, or specifying variables and "dotenv" files in now.json.

However, this of course is only supported once deployed to now, but it would be great to have support for this in dev without adding in something extra such as dotenv or the like.

Would it make sense to add that to micro-dev? We could use something like https://github.com/sergiodxa/now-env fairly easily I think.

Can we add https to avoid Mixed Content block?

How do I run micro-dev using https?

If I run it as http, and try to call it from my development website in Chrome I get the Mixed Content block.

Mixed Content: The page at 'https://localhost:8080/' was loaded over HTTPS, but requested an insecure resource 'http://localhost:3000/api/login'. This request has been blocked; the content must be served over HTTPS.

--ignore causing "Cannot find module" for ignored directory

I'm building a file upload microservice and storing my temporary uploaded files in ./tmp (for compatibility with now). I set up my start task to ignore this directory and it's two subdirectories (uploads and downloads):

"dev": "micro-dev -p ${PORT:-3001} --ignore ./tmp/**",

However when I yarn run dev I get an error that it Cannot find module 'tmp/uploads'.

Here's the full stack trace:

micro: Error when importing /Users/nickwientge/Desktop/process/tmp/uploads: Error: Cannot find module '/Users/nickwientge/Desktop/process/tmp/uploads'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at module.exports.file (/Users/nickwientge/Desktop/process/node_modules/micro-dev/node_modules/micro/lib/handler.js:22:11)
    at module.exports (/Users/nickwientge/Desktop/process/node_modules/micro-dev/lib/serve.js:15:55)
    at Object.<anonymous> (/Users/nickwientge/Desktop/process/node_modules/micro-dev/bin/micro-dev.js:96:1)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

res.headersSent is false

If I start the project with micro-dev, when I use the send function the res.headersSent is false. With micro it's true. Why?

Hot-reload doesn't work with @std/esm loader

@std/esm is very convievent way to teach Node to load EcmaScript6+ modules. Unlike babel-register it is suited for production with almost zero overhead. You can read more about ESM in release blogpost.

When using micro-dev to run app written with help of ESM loader, hot-reloader doesn't pick the source files chages. Maybe the ESM's cache is somehow part of the problem, but I'm reporting it here so devs of this project gets aware of this problem.

Parsing json hangs

I had been using micro perfectly fine locally, but then decided to use micro-dev for local development, but it won't parse the json body of my requests anymore :\ I'm sending the requests via postman. Not sure what's different or if I missed something in the docs/setup. (I didn't change source code at all).

Gist of code

The important part of my gist is index.ts, and the function waitForEmail line 75

Versions
Node: 8.4.0 and 8.5.0
NPM: 5.3.0 and 5.4.2
OS: WIndows 10 Pro and Ubuntu (WSL); both 64bit

(package.json given in gist, shows latest versions of micro and micro-dev).

Thanks for reading!

micro-dev command fails ( npm run dev)

Tried the micro-dev command and it failed. below is the output from the command:

>npm run dev

 [email protected] dev /home/.../microservice
 micro-dev

/home/.../microservice/node_modules/micro-dev/lib/serve.js:10
module.exports = async (file, flags, restarting) => {
                       ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/.../microservice/node_modules/micro-dev/bin/micro-dev.js:12:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `micro-dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Which node runtime do you recommend for micro-dev to run since the other one

> npm start  
> [email protected] start /home/muthah/ad/dev/node/microservice
> micro
>micro: Accepting connections on port 3000

runs perfectly. Iam using node 6.11

package.json

{
  "name": "microservice",
  "version": "0.0.1",
  "description": "micro service POC",
  "main": "index.js",
  "scripts": {
  "start": "micro",
  "dev": "micro-dev",
  "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/"
  },
}

what's with the favicon?

Hi there,

I'm trying out micro-dev and loving it so far. But every time I refresh the browser and the service/functionruns again, there are two requests. The one from the browser, and the one from the favicon.
It's also trashing my terminal. Can this be avoided?

Using this right now:

if (req.url === '/favicon.ico') {
  res.end();
}

image

Hot reloading with Visual Studio Code

Not sure if this is a VSCode issue, a micro-dev issue or a PEBCAK issue here. And may be related to #21.

We originally had a setup where we were using nodemon over Micro to watch for changes and restart the server when changes were detected. However, I couldn't get it to play nice with Visual Studio Code for some reason.

Whilst researching around this, I stumbled across this seemingly new micro-dev and have been using it, and it looks cool! I love the more dev-friendly nature of it. And the hot-reloading looked like the solution to our nodemon VSCode issues. We want debugging and what have you, but we also (ideally) want hot reloading.

I've set up this VSCode launch configuration. It correctly launches and I can debug normally. And if I change the files, it does (apparently) restart the server. However, if I change one of the files to insert a new console log or similar and save, when I then perform the action, nothing new is logged. And if I hit a breakpoint after the server restart, adding a new variable, VSCode acts as though it is not there and throws a ReferenceError if I try and call it. It is as though the change wasn't there.

Oddly enough, Aurelia Watch on the front end seems to work fine. Though... I don't get debug support there, console logs and such will work.

Here's my launch configuration if it helps:

        {
            "type": "node",
            "request": "launch",
            "name": "Launch API dev",
            "cwd": "${workspaceRoot}/api/content",
            "program": "${workspaceRoot}/api/content/node_modules/micro-dev/bin/micro-dev.js",
            "restart": true, 
            "args": [
                "src/gateway.js"
            ]
        }

The restart: true was just added just in case it prompts VS to restart itself on a hot-reload. Bit of a shot in the dark

Any ideas on this? Not sure if a fix to #21 would fix this too, or it may be completely unrelated. Or maybe it's something I'm not doing right.

micro-dev exits on error

🍰 Expected behavior:

My code gets up after crash, thanks to amazing power of micro-dev.

πŸ’₯ Actual behavior:

[d:micro] npm ERR!
[d:micro] npm ERR! Faioled at the [email protected] d:micro script.
[d:micro] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[d:micro]

Both my microservice and micro-dev die because I've made typo and saved.
Hot reloading combined with exiting on error actually means I restart the server more times than I would have without hot reload. 😒

Pretty nice package in spite of it.

Babel support?

Probably very noob question, but how do I use that with Babel?

So far I used babel-watch in the script. And called micro programmatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.