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

Serve the full website #36

Closed
niicojs opened this issue May 12, 2018 · 5 comments
Closed

Serve the full website #36

niicojs opened this issue May 12, 2018 · 5 comments

Comments

@niicojs
Copy link

niicojs commented May 12, 2018

I think it would be better to:

  • server the full website (easier to test lambda functions in context)
  • server the function with the /.netlify/functions/ path)
  • parse .env to set environment variables

I did it here for personal use, I can PR it if it make sense for others.

@niicojs niicojs changed the title Server the full website Serve the full website May 12, 2018
@sparkalow
Copy link

@niicojs It makes sense for me. I'll use your fork unless/until there is an alternative.

@DavidWells
Copy link
Contributor

There are many different ways people serve their app depending on the framework, setup, etc. etc. etc.

I'd suggest an approach like this https://github.com/netlify/netlify-faunadb-example/blob/master/package.json#L15-L17

Where you can use npm-run-all to run the function code + your web app in the same terminal session.

If you clone down that repo, npm install, and npm start you can see it in action

@sparkalow
Copy link

Thanks for the suggestion @DavidWells. In my specific case I'm not using react or webpack and don't want those additional dependencies just to proxy requests. I'm using browsersync for serving static files and can proxy netlify-lambda functions locally, but without native rewrite support. This makes niicojs' idea/fork useful to me.

@8eecf0d2
Copy link
Contributor

@sparkalow if you're still looking for alternatives, I've written 8eecf0d2/netlify-local to support more Netlify services locally, namely the static file server for the publish directory of netlify.toml configs. Webpack is included as a dependency but usage is completely optional.

@swyxio
Copy link
Contributor

swyxio commented Oct 17, 2018

Thanks all - i think we're gonna keep netlify-lambda small/general as possible. But @8eecf0d2 and @niicojs's approaches are interesting and i will link to you from the github. if we get more feedback like this from people i am open to reopening this

@swyxio swyxio closed this as completed Oct 17, 2018
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

No branches or pull requests

5 participants