├── .env
├── .gitignore
├── .vscode
└── tasks.json
├── README.md
├── circle.yml
├── docs
├── CNAME
├── assets
│ ├── js
│ │ └── bundle.js
│ └── json
│ │ └── settings.json
└── index.html
├── gulpfile.js
├── hjson
└── settings.hjson
├── logo.png
├── package-lock.json
├── package.json
├── rollup.config.js
├── social_preview.png
├── src
├── Domain
│ ├── Model
│ │ ├── Article.ts
│ │ ├── ArticleContainer.ts
│ │ ├── ArticleTabItem.ts
│ │ ├── Comment.ts
│ │ ├── MenuItem.ts
│ │ ├── PostArticle.ts
│ │ ├── PostUser.ts
│ │ ├── Profile.ts
│ │ ├── Scene.ts
│ │ ├── ServerError.ts
│ │ ├── User.ts
│ │ └── UserForm.ts
│ ├── Repository
│ │ ├── ConduitProductionRepository.ts
│ │ ├── Interface
│ │ │ ├── ConduitRepository.ts
│ │ │ └── UserRepository.ts
│ │ └── UserLocalStorageRepository.ts
│ ├── UseCase
│ │ ├── ApplicationUseCase.ts
│ │ ├── ArticleUseCase.ts
│ │ ├── ArticlesUseCase.ts
│ │ ├── EditerUseCase.ts
│ │ ├── LoginUseCase.ts
│ │ ├── ProfileUseCase.ts
│ │ ├── RegisterUseCase.ts
│ │ └── SettingsUseCase.ts
│ └── Utility
│ │ └── MenuItemsBuilder.ts
├── Infrastructure
│ ├── HTTPURL.ts
│ ├── HTTPURLParser.ts
│ ├── Initializable.ts
│ ├── SPALocation.ts
│ ├── SPAPathBuilder.ts
│ └── Settings.ts
├── Presentation
│ ├── ApplicationController.ts
│ ├── View
│ │ ├── ArticleTabView.riot
│ │ ├── ArticleView.riot
│ │ ├── ArticleWidgetView.riot
│ │ ├── ArticlesTableView.riot
│ │ ├── BannerView.riot
│ │ ├── CommentFormView.riot
│ │ ├── CommentTableView.riot
│ │ ├── FooterView.riot
│ │ ├── HeaderView.riot
│ │ ├── MarkdownView.riot
│ │ ├── PagenationView.riot
│ │ ├── ProfileView.riot
│ │ └── TagsView.riot
│ ├── ViewController
│ │ ├── Article.riot
│ │ ├── ArticleViewController.ts
│ │ ├── Articles.riot
│ │ ├── ArticlesViewController.ts
│ │ ├── Editer.riot
│ │ ├── EditerViewController.ts
│ │ ├── Login.riot
│ │ ├── LoginViewController.ts
│ │ ├── Profile.riot
│ │ ├── ProfileViewController.ts
│ │ ├── Register.riot
│ │ ├── RegisterViewController.ts
│ │ ├── Settings.riot
│ │ ├── SettingsViewController.ts
│ │ └── ShowError.riot
│ └── application.riot
└── main.ts
├── test
├── HTTPURLParserTest.ts
├── SPALocationTest.ts
└── SPAPathBuilderTest.ts
├── tsconfig.json
└── tslint.json
/.env:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iq3addLi/riot_realworld_example_app/2af5fc527f492a992cb2710732c07d8765de5f8e/.env
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "command": "sh",
4 | "args": ["-c"],
5 | "presentation": {
6 | "echo": true,
7 | "reveal": "always",
8 | "focus": false,
9 | "panel": "shared",
10 | "showReuseMessage": true,
11 | "clear": false
12 | },
13 | "echoCommand" : true,
14 | "tasks": [
15 | {
16 | "label" : "build",
17 | "command": "npm run build",
18 | "type" : "shell",
19 | "group": {
20 | "kind": "build",
21 | "isDefault": true,
22 | },
23 | "isBackground" : false,
24 | "problemMatcher": [
25 | "$tsc",
26 | "$gulp-tsc"
27 | ]
28 | },
29 | {
30 | "label" : "test",
31 | "args" : ["npm run test"],
32 | "type" : "shell",
33 | "group": {
34 | "kind": "test",
35 | "isDefault": true
36 | },
37 | "isBackground" : false,
38 | "problemMatcher": [
39 | "$tsc",
40 | "$gulp-tsc"
41 | ]
42 | }
43 | ]
44 | }
45 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](http://realworld.io) [
](https://Riot.js.org) [](https://circleci.com/gh/iq3addLi/riot_realworld_example_app)
2 |
3 | # 
4 |
5 | > ### Riot.js codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.
6 |
7 |
8 | ### [Demo](http://riot-realworld.addli.co.jp) [RealWorld](https://github.com/gothinkster/realworld)
9 |
10 | This codebase was created to demonstrate a fully fledged fullstack application built with **Riot.js** including CRUD operations, authentication, routing, pagination, and more.
11 |
12 | We've gone to great lengths to adhere to the **Riot.js** community styleguides & best practices.
13 |
14 | For more information on how to this works with other frontends/backends, head over to the [RealWorld](https://github.com/gothinkster/realworld) repo.
15 |
16 |
17 |
18 | | ℹ️ Important Notices |
19 | | :----------------------------------------------------------- |
20 | | Here's the document from when I updated from v3 to v4. I was able to update v5 **without any difficulty at all**. And so far, **v7 works fine**. Riot.js is awesome!!😊 |
21 |
22 |
23 |
24 | ## Introduction
25 |
26 | Please see [here](https://riot.js.org) about Riot.js. Recently I often see what is called the **frontend framework**. This library is useful for HTML componentization and reusability. Although Riot.js can be used in a wide variety of ways, please be aware that the usage for this example is as follows.
27 |
28 | * Aware of large-scale development
29 | * Incorporates iOS Application development methods
30 |
31 | These will be explained later. Perhaps there is a big difference from the coding of other samples out there. I currently please feedback on the coding of this project on the [discord channel of Riot.js](https://discord.gg/PagXe5Y). It follows the standard expected API usage and guarantees that it is *not tricky*.
32 |
33 | [toc]
34 |
35 |
36 |
37 |
38 | ## How it works
39 |
40 | ### On local
41 |
42 | Same to [v3](https://github.com/iq3addLi/riot_v3_realworld_example_app#getting-started).
43 |
44 | #### Clone project
45 |
46 | ```bash
47 | $ cd << your working directory >>
48 | $ git clone https://github.com/iq3addLi/riot_realworld_example_app.git
49 | ```
50 |
51 | #### Install packages
52 |
53 | ```bash
54 | $ cd riot_realworld_example_app
55 | $ npm install
56 | ```
57 |
58 | #### Launch server
59 |
60 | ```bash
61 | $ gulp connect
62 | ```
63 |
64 | #### Open in browser
65 |
66 | ```bash
67 | $ open http://localhost:8080
68 | ```
69 |
70 |
71 |
72 | ### How to build
73 |
74 | #### Build with gulp and rollup
75 |
76 | ```bash
77 | $ gulp
78 | ```
79 |
80 | For details, please read [gulpfile](https://github.com/iq3addLi/riot_realworld_example_app/blob/master/gulpfile.js).
81 |
82 |
83 |
84 | ## Getting started
85 |
86 | ### Entrance
87 |
88 | [src/main.ts](src/main.ts) is entrance of code. Follow *import*. Enjoy the contents of the code!
89 |
90 |
91 |
92 | ### Change API Server
93 |
94 | [hjson/settings.hjson](hjson/settings.hjson) contains the API server host. Let's change to the API you built.
95 |
96 | ```json
97 | // endpoint of Conduit API ( '/' suffix is unneed )
98 | //"endpoint": "https://conduit.productionready.io/api"
99 | "endpoint": "http://127.0.0.1:8080"
100 | ```
101 |
102 | It changes when you build.
103 |
104 |
105 |
106 | ## Design policy
107 |
108 | Same completely to [v3](https://github.com/iq3addLi/riot_v3_realworld_example_app#design-policy).
109 |
110 |
111 |
112 | ## How this project uses Riot.js
113 |
114 | ### Pre-compile with npm packages
115 |
116 | Riot.js can compile `.riot` files on browser side. This is very convenient for getting started quickly. However, I chose to precompile with npm for this project. This is because TypeScript can be used for most of the implementation code. When developing applications as large as RealWorld, type checking with TypeScript greatly contributes to work efficiency.
117 |
118 | After a few trials, I concluded that the compilation task is rollup and other tasks are reliable to do with gulp. See **gulpfile.js** and **rollup.config.js**. I hope it will help those who are considering taking a configuration like this project.
119 |
120 |
121 |
122 | ### `.riot` is the interface definition
123 |
124 | I treated the `.riot` file as an interface definition. Information to be displayed on the `.riot` side and functions called from event handlers are not coded in this, but are coded in `*ViewController.ts`.
125 |
126 | The reason is next
127 |
128 | #### I wanted to use TypeScript as much as possible.
129 |
130 | There is a way to write TypeScript in
19 |