Skip to content

Commit

Permalink
WIP: Remaining items
Browse files Browse the repository at this point in the history
  • Loading branch information
cromedome committed Feb 5, 2025
1 parent 3784cac commit 7d439a1
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions lib/Dancer2/Manual/Tutorial.pod
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,6 @@ C<POST> route to actually perform the deletion.
We'll also need a route to see the list of all blog entries. This will use
the HTTP C<GET> method.

TODO: can/should we combine the routes below with the CRUD explanation
above?

=head3 Add an Entry (Create)

This requires two routes: one to display the create form, and another to
Expand Down Expand Up @@ -1904,16 +1901,65 @@ Your finished application code should look like this:

=head1 Finishing Touches

At this point, Danceyland has a fully functional blog engine, and your
users are chomping at the bit to start using it. Before we let them loose
on your new creation, let's pretty it up, write some tests, and get it
deployed to a production environment.

=head2 Adding some style

=head1 Testing Your Application

Always good to run your tests in the production environment to ensure there
are no surprises when you restart the application server. Let's see how
we can write some basic functionality tests.

=head2 Using Test::WWW::Mechanize::PSGI

=head1 Deployment

=head2 Creating Production Configuration

The default Dancer2 configuration provides a lot of information to the
developer to assist in debugging while creating an application. In a
production environment, there's too much information being given that can
be used by someone trying to compromise your application. Let's create
an environment specifically for production to turn the level of detail down.

If you were using a database server instead of SQLite, you'd want to update
database credentials in your production configuration to point to your
production database server.

Replace your F<environments/production.yml> file with the following:

# configuration file for production environment

# only log info, warning and error messsages
log: "info"

# log message to a file in logs/
logger: "file"

# hide errors
show_stacktrace: 0

# disable server tokens in production environments
no_server_tokens: 1

# Plugin configuration
plugins:
DBIx::Class:
default:
dsn: "dbi:SQLite:dbname=db/dlblog.db"
schema_class: "DLBlog::Schema"
dbi_params:
RaiseError: 1
AutoCommit: 1
CryptPassphrase:
encoder:
module: Argon2
parallelism: 2

=head2 Deploying with a PSGI Server

=head2 Configuring Reverse Proxy with NGINX
Expand Down

0 comments on commit 7d439a1

Please sign in to comment.