|
Populate your job board with dummy dataAssumng you are following along with the tutorial and running locally, you now have a job board with one user ("testuser") and no jobs, unless you took the time to create additional test data manually. When quickly hacking together a data-driven website, populating your app with dummy data is a chore you want to avoid wasting time on, so let's see how to do that. Firstly, restart Happstack in a pristine state by either deleting or backing up your _local data directory as described earler. Now, click this link. If everything worked right, you should now have two users and a couple hundred jobs worth of test data displaying in your jobs site. What have we done here? We've used the code found in ControllerStressTests.hs to take action on the tutorial application state, which is to be found in AppState1.hs. Now that you've had a basic introduction of using Happstack.State, I recommend looking through these files to get a better feel for more complicated examples. Now we need to discuss what to do when you need to change your data types. |