FountainJS / generator-fountain-webapp

Yeoman 'fountain' generator to start a webapp
http://fountainjs.io
MIT License
967 stars 67 forks source link

What is the suggested way to add middleware or a database to a Fountain setup? #203

Closed elliottregan closed 7 years ago

elliottregan commented 7 years ago

Prerequisites

I'm using the VueJS generator, but this should apply to any generator. I know that questions are best asked on Slack or SO, but those communities are pretty dead at the moment.

Description

I'm looking to set up some simple GET and POST requests. Should I accomplish that with BrowserSync's middleware, or something else?

In the same vein as that, what is the intention when going to production? I assume you don't intend for BrowserSync to run in production. Should I be setting up separate Gulp tasks to serve my files without BrowserSync?

Swiip commented 7 years ago

There is to ways to deal with backend requests with the BrowserSync server. First, you request another URL and have to deal with URL configuration and CORS on your server. Second, you setup a proxy middleware in your BrowserSync, there are some ready to use on NPM (BrowserSync is compatible with Express middlewares).

In production, you absolutely should not use BrowserSync. Fountain provides a build task which generate a dist folder which is ready to use with any static HTTP server.

elliottregan commented 7 years ago

Thanks!