Skip to content
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

How to run node.js code and/or next.js api routes? #1

Open
hems opened this issue Mar 10, 2023 · 1 comment
Open

How to run node.js code and/or next.js api routes? #1

hems opened this issue Mar 10, 2023 · 1 comment
Assignees

Comments

@hems
Copy link

hems commented Mar 10, 2023

Hello,

Thanks a lot for putting this together.

I'm wondering how to use node modules and/or next.js API routes when using next.js with nw.js?

Any chance this example could be updated to demo such functionalities?

Thank You

@ayushmanchhabra
Copy link
Contributor

ayushmanchhabra commented Apr 23, 2023

@hems Hello, apologies for the late response!

how to use node modules and/or next.js API routes

You install modules as dev dependencies and use them as usual. I'll soon add a build step to copy dependencies (not dev deps) from Node manifest to NW.js manifest (nwutils/nw-builder#842).

Next.js routing should work as it does as long as you work within the same window (https://nwjs.readthedocs.io/en/latest/References/Window/). I haven't explored routing with multiple windows though. This document from the wiki might help:
https://github.com/nwjs/nw.js/wiki/About-Node.js-server-side-script-in-nw.js#router

Any chance this example could be updated to demo such functionalities?

I will try to update the repo in the coming week. In the meantime if you get it to work feel free to open PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants