Blog magazine
This application creates the following tables in the database:
- article: table of articles (or posts) to publish
- author: table of authors
- theme: table of themes (or sections)
- attachment: table of attachments to an article, mainly images or du texts
- comment: table of comments written by readers
This application demonstrates the use of CykLang for server-side management, while the client-side has been programmed using the VueJS framework.
Install
Make sure you are in your Cyk project directory, then use the command npx cyk to download and install the 2 packages that make up the application:
cd cyk-project
npx cyk install @cyklang/demo-blog
The package @cyklang/demo-blog:
- creates the tables in the database
- Install the application for blog writers to enable them to update articles.
npx cyk install @cyklang/demo-blog-client
The package @cyklang/demo-blog-client:
- install the web application for visitors of the blog. Has been developped with framework VueJS
With a browser, open a page on the Cyk server: http://localhost:3000
Replace 3000 by the port of your NodeJS server if you have changed the default value
Identify yourself
By default, the blog is configured in a private mode, meaning its content is subject to authentication (we will see later how to configure this application). You should therefore see the following login page :

The credentials of the administrator user (default login cyk and password cyk) allow you to log in.
At the beginning, the database tables are empty. Therefore, no articles are displayed in the viewing application
Enter articles
At the top right of the screen, click on the 'Edit' button to open the Writers application. It opens in a new tab (or window) of the browser.
- Enter at least one theme (or category)
- Enter at least one author
- Now enter at least one article (theme and author are mandatory).

The entry of an article is done in several steps. :
- The properties of the article (theme, author, title, summary). This allows you to create the article.
- The choice of the representative image for the article.
- The writing of the main text of the article in Markdown format.
Publish
The Publish button on the toolbar of the Articles screen triggers the automatic creation of the blog's homepage following the following rules:
- The rotating banner is composed of the 6 latest articles (based on the Date field of the article).
- The 'Trends' section is composed of the top 5 articles ordered by the article's rating and date.
- For each theme and in the order specified by the 'Order' field, the 10 latest articles (based on the Date field of the article) are displayed..
The browser then switches to the tab displaying the blog reading application. However, the content is not automatically updated. Refresh the browser page to see the changes.
