wasp/examples/waspleau
Filip Sodić 2fe7398462
Adapt example apps to project struct change (#809)
* Separate ext code to client and server

* Use skeleton in createNewProject and refactor

* Refactor Lib.hs to use ExceptT

* Fix formatting

* Pop up returns

* Extract liftIO and add a do block

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Address some review comments

* Add skeleton comment

* Extract common CommandError message

* Separate skeleton comment into two rows

* Move server and client dirs into src

* Simplify maybeToEither

* Further refactor Lib.hs

* Further simplify skeleton comment

* Add shared code directory to project structure

* Update e2e test inputs

* Update e2e test outputs

* Fix formatting

* Fix bug in compile function

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>

* Change map to fmap in compile function

* Fix formatting

* Force git to include empty directories

* Remove extra empty line from .gitkeep files

* Add .jsconfig to enable go-to-definition

* Watch shared directory for changes

* Add final newline to jsconfigs

* Fix regular and e2e tests

* Update e2e tests

* Fix cli template packaging and update todoApp

* Add a shared function demo to todoApp

* Update waspc and e2e tests

* Fix compiler warnings and rename function

* Rename mkError to mkParserError

* Remove redundant empty line

* Fix test warnings

* Fix formatting

* Update waspc.cabal with jsconfigs

* Minimize jsconfig.json files

* Add jsconfigs to waspc todoApp

* Update e2e tests

* Update e2e tests

* Update docs for new project structure

* Update todoApp example to new structure

* Update ItWaspsOnMyMachine

* Update thoughts

* Update Waspello to new structure

* Update Waspleau to new structure

* Update Realworld to new structure, fix warnings

* Fix directory tree watching on wasp start

* Implement review feedback

* Fix typo in docs

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Fix typo in docs

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Fix another typo in docs

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Add src prefix to file path in docs

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Remove env server file

* Apply suggestions from code review

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Address code review comments

* Fix incorrect path in docs

* Fix references to ext in docs

* Edit changelog and add migration guide

* Further update docs to new structure

* Update blogs about example apps to new structure

* Fix typo in docs

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Update typo on frontpage

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Add missing src in docs

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>
Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2022-11-11 18:58:29 +01:00
..
migrations Updates Waspleau with Jobs and some documentation updates (#600) 2022-05-25 12:55:54 -04:00
src Adapt example apps to project struct change (#809) 2022-11-11 18:58:29 +01:00
.gitignore Adapt example apps to project struct change (#809) 2022-11-11 18:58:29 +01:00
.wasproot Adapt example apps to project struct change (#809) 2022-11-11 18:58:29 +01:00
main.wasp Adapt example apps to project struct change (#809) 2022-11-11 18:58:29 +01:00
Notes.md Renames auth method EmailAndPassword to UsernameAndPassword (#696) 2022-08-24 10:32:46 -04:00
README.md Updates Waspleau with Jobs and some documentation updates (#600) 2022-05-25 12:55:54 -04:00

Waspleau

Welcome to the Waspleau example! This is a small Wasp project that will allow you to setup an easy Dashboard that pulls in data via Jobs and stores them in the database.

Step 1

Clone this repo

Step 2

Update ext/workers with whatever you want to track, add them to main.wasp as a job, and optionally import and use them in serverSetup.js (or other server-side code).

Step 3 (with PostgreSQL running)

NODE_ENV=development DATABASE_URL="postgresql://postgres@localhost/waspleau-dev" wasp db migrate-dev

Step 4

NODE_ENV=development DATABASE_URL="postgresql://postgres@localhost/waspleau-dev" wasp start

This will start your background workers as Wasp Jobs and present a dashboard UI that will auto-refresh every minute.

Note: As you develop your own workers, keep in mind each time you save a file in the project it will automatically reload everything, including restarting your server, which may re-submit or terminate running jobs.

Heroku Deployment Note

If you wish to deploy this on Heroku, pg-boss will fail to initialize as for some reason the pg client does not attempt to connect over SSL by default. This results in an error like:

pg-boss failed to start!
2022-05-18T19:07:37.464126+00:00 app[web.1]: error: no pg_hba.conf entry for host "***", user "***", database "***", SSL off

Ref: https://help.heroku.com/DR0TTWWD/seeing-fatal-no-pg_hba-conf-entry-errors-in-postgres

Even if you force SSL, it will still fail as Heroku uses a self-signed certificate. The solution is to set a PG_BOSS_NEW_OPTIONS environment variable to something like this:

{"connectionString":"<your-heroku-DATABASE_URL>","ssl":{"rejectUnauthorized":false}}

Ref: https://devcenter.heroku.com/articles/connecting-heroku-postgres#connecting-in-node-js