-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't keep him running with my node server #1
Comments
Hi Kevin, Sorry, I didn't get a chance to look at this yet. The task should just start up the apimocker server... The task will stop, but the server should keep running. I'll take a look at it and get back to you. Thanks. -Greg
|
Hi Greg, thanks for your fast answer. It would be very nice if you take a look. It would be also very great if you could help me with this question: Kind regards |
Hi, I added a new sample-project-gruntfile.js to this github project for documentation. I hope this helps you. I used it for testing out the grunt-apimocker task. You can see around line 315, that I run apimocker as part of the 'serve' grunt task, not as part of the 'watch' task. Does this do what you need? The 'watch' task doesn't really make sense for apimocker… since you don't want to start the apimocker server whenever you make a change in your app. Right? If you do want it to run as part of the 'watch' task, can you explain your use case? Thanks. -Greg
|
@snyoz Please let me know if my last comment helped solve your problem, or if you need something else. Thanks. -Greg |
I can also confirm that the server does not stay up once the task completes. Running |
Hi Greg, it was perfectly for me! Great! The only thing I added additionally was: // Enable API MOCKER apimocker: { options: { configFile: 'node_modules/grunt-apimocker/node_modules/apimocker/config.json' } }, and to watch the JSON Mocks: // Watches files for changes and runs tasks based on the changed files watch: { apimocker: { files: ['node_modules/grunt-apimocker/node_modules/apimocker/mocks/{,*/}*.json'] }, }, Kind regards |
@kevinoconnor7 Did you get this working yet? Hopefully the comments in this thread were helpful for you. If you still have issues, let me know. |
Hi @gstroup.. im traying to use this grunt no global, but server never starts, tested with this configs but doesn't keep alive. Any solution to this? Command: grunt apimocker Done, without errors. |
I think the problem is that the apimocker server will only stay up and running as long as another grunt task keeps the process up and running. If you run apimocker in your grunt 'serve' task, along with a web server like express, then the apimocker server process should remain up and running. Can you try that? (This is an issue that we need to fix in this grunt-apimocker plugin project, but I haven't had time to work on it. Pull requests welcome!) |
Hi Greg, thank you for your plugin. It seems to me that you can fix it just adding this.async() at the end of the tasks/apimocker.js file like this
But if you do this, all previous configs will be broken. If you want, I can add an optional parameter and send you a pull request. |
@moro-programmer, I think you have a good idea. But why would it break all previous configs? Sorry, I have not given much attention to this plugin. If you are able to make a pull request, that would be great! I will get it merged in pretty quickly. Thanks a lot. |
Hi. All previous configs can be broken because the next task waits apimocker. But I have added the wait parameter with default state "false". If you set it true, then the apimocker will not exit. I have sent you the pull request. |
How Can I start the task on watch with my node?
Which port I have to choose in my config.json?
When I do: $ grunt apimocker it starts successfully. But after it the task stops.
I would be very thankful for your help.
I followed all your instructions but it doesnt work.
Kind regards,
Kevin
The text was updated successfully, but these errors were encountered: