OSS framework 'Phoenix Framework' that can easily develop web applications, also a movie that develops Twitter-like applications in 15 minutes



Frameworks for developing web applications include

Ruby on Rails, etc., but using one of those frameworks, the open source ' Phoenix Framework ', you can easily develop web applications.

Phoenix Framework
https://www.phoenixframework.org/

First, build the development environment. This time I will build the environment on Ubuntu 20.04.

Ubuntu 20.04 LTS (Focal Fossa)
https://releases.ubuntu.com/20.04/



Phoenix Framework depends on the package management system and

npm for some functions, so install it in advance. Use PostgreSQL which is recommended by default for the database.

Node.js
https://nodejs.org/ja/



PostgreSQL: The world's most advanced open source database

https://www.postgresql.org/



Phoenix Framework uses the programming language

Elixir , so I installed it.

[code] wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
sudo apt update && sudo apt install esl-erlang erlang-dev erlang-parsetools elixir [/ code]



In addition, Phoenix Framework has a live reloading function that automatically reloads content when a web application is updated, but it is necessary to install inotify-tools in order to use that function on Linux.

[code] sudo apt install inotify-tools [/ code]



Hex package is required to use Phoenix Framework, so execute the following command in the project directory and install it.

[code] mix local.hex [/ code]



Install Phoenix Framework. This completes the development environment construction.

[code] mix archive.install hex phx_new 1.5.1 [/ code]



Create a 'hello' project with Phoenix Framework.

[code] mix phx.new hello [/ code]



When executed, dependent packages are placed under the 'hello' directory.



Move to the 'hello' directory and create a database.

[code] mix ecto.create [/ code]



Launch the web app.

[code] mix phx.server [/ code]



When I accessed 'http: // localhost: 4000' with a browser, the welcome screen was displayed safely.



Next, let's actually create a simple web application. However, the Phoenix Framework has a function that automatically builds the necessary elements for a web application according to

MVC , so you can create something just by entering a simple command.

[code] mix phx.new test
cd test
mix ecto.create
mix phx.gen.html Accounts User users Name: string Age: integer Gender: string [/ code]



It is necessary to add the route manually, so add the route to './lib/test_web/router.ex'.



Apply the setting with the following command ……

[code] mix ecto.migrate [/ code]



Launch the web app.

[code] mix phx.server [/ code]



When accessing 'http: // localhost: 4000 / users' with a web browser, a web app for creating a list of users was displayed as shown below. Click “New User” ……



You can add users.



With this feeling, I was able to easily create a web application that manages users.



A movie that develops a web application such as Twitter in 15 minutes using the Phoenix Framework has been released.

Build a real-time Twitter clone in 15 minutes with LiveView and Phoenix 1.5-YouTube


The completed web application looks something like this, and it certainly has a timeline like Twitter.



In addition, ' Phoenix Live Dashboard ' that can check the version of the package group required for Phoenix Framework and the start time of the web application is also provided on GitHub.

GitHub-phoenixframework / phoenix_live_dashboard

https://github.com/phoenixframework/phoenix_live_dashboard

in Software, Posted by darkhorse_log