Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Apr 27, 2015
1 parent 3207f47 commit 465e1f7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
26 changes: 24 additions & 2 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ To create a skeleton web application, run:
$ dub init vibed-mongo vibe.d
This will make in directory ``vibed-mongo`` with a minimal HTTP server based on vibe.d.
This will make in directory ``vibed-mongo`` with a minimal HTTP server based on vibe.d_.

.. _vibe.d: http://vibed.org


The configuration file ``dub.json`` will look something like this:

Expand Down Expand Up @@ -179,7 +182,7 @@ The project has the following structure:
style.css
favicon.ico
After installing MongoDB, run the server
After installing MongoDB_, run the server

.. code-block:: shell
Expand Down Expand Up @@ -209,6 +212,9 @@ In another console run the Mongo interpreter
The above script creates a ``vibed`` database with a ``userlist`` collection, which will contain one record.
.. _MongoDB: https://www.mongodb.org
Patches
^^^^^^^^^
Expand All @@ -224,6 +230,22 @@ Comparing with the original article ``global.js`` was slightly changed:
:tab-width: 4
:lines: 129-138
Diet Templates
^^^^^^^^^^^^^^
`Diet templates`_ are HTML templates which are statically compiled down to native D code.
Diet templates syntax equals that of Jade templates with the exception of some of the advanced syntax features.
First lines of ``index.dt``:
.. literalinclude:: ../../examples/vibed-mongo/views/index.dt
:language: d
:tab-width: 4
:lines: 1-12
.. _Diet templates: http://vibed.org/templates/diet
Service
^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion examples/vibed-mongo/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import service;

shared static this()
{
immutable string title = "vibe.d web app";
immutable string title = "vibe.d";

logInfo("Connecting to DB...");
auto db = connectMongoDB("localhost").getDatabase("vibed");
Expand Down
9 changes: 8 additions & 1 deletion examples/vibed-mongo/views/index.dt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
extends layout

block content
h1= title
- /++
- The main difference is that you write D expressions and
- statements instead of JavaScript.
- +/
- import std.format;
- auto fullTitle = format("%s web app", title);

h1= fullTitle
p Welcome to our test

// Wrapper
Expand Down

0 comments on commit 465e1f7

Please sign in to comment.