Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Next.js で Ruby をプログラミング&実行できるアプリを作る
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
uutan1108
January 18, 2024
Programming
1.9k
0
Share
Next.js で Ruby をプログラミング&実行できるアプリを作る
エンジニアの自由研究発表会vol.9
https://tech-street.connpass.com/event/305362/
uutan1108
January 18, 2024
More Decks by uutan1108
See All by uutan1108
映画のエンドロール風の動画を自動生成するツールを作った
ohmori_yusuke
2
46
アウトプットは“成果物”じゃなく“副産物”だった話
ohmori_yusuke
1
80
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
740
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
5.8k
勉強会から始まった僕のDevRel~新卒エンジニアがつないだ2年間の軌跡~
ohmori_yusuke
2
450
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
320
アニメがエンジニアをつなぐ!「エンジニアニメ」勉強会が巻き起こすCo-Creationの波
ohmori_yusuke
0
290
組織が大きく変わろうとするとき、自分はどうありたいかを考えている
ohmori_yusuke
19
7.4k
技術以外をきっかけに交流するエンジニア向け勉強会
ohmori_yusuke
0
180
Other Decks in Programming
See All in Programming
ファインチューニングせずメインコンペを解く方法
pokutuna
0
310
Getting more out of Maven
mlvandijk
0
110
KagglerがMixSeekを触ってみた
morim
0
380
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
120
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
470
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
370
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
210
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
1
330
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
250
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
500
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.9k
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
160
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.2k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
260
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Paper Plane
katiecoart
PRO
1
49k
Speed Design
sergeychernyshev
33
1.6k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
260
Code Review Best Practice
trishagee
74
20k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
The Cult of Friendly URLs
andyhume
79
6.8k
Transcript
Next.js で Ruby を プログラミング&実行できる アプリを作る エンジニアの自由研究発表会vol.9 うーたん
自己紹介 • うーたん • 新卒サーバーサイドエンジニア ◦ 株式会社ゆめみ • 趣味 ◦
アニメを見ること • X ◦ @uutan1108
目次 - 作ったもの - 仕組み - Server Actions - @ruby/wasm-wasi
- 終わりに
作ったもの
None
None
Ruby のコードを Next.js のみで実行できる
仕組み
仕組み ・Server ActionsはNext.js 14でStableになった機能です。 サーバー側で関数を実行できます。 ・サーバー側の実行結果をクエリパラメータに与えリダイ レクト させます。
実行前 実行後
Server Actions
Server Actions and Mutations サーバーアクションは、サーバー上で実行される非同期関数で す。サーバーコンポーネントやクライアントコンポーネントで使 用し、Next.jsアプリケーションのフォーム送信やデータを処理し ます。 https://nextjs.org/docs/app/building-your-application /data-fetching/server-actions-and-mutations
Server Actions ・フォームのsubmitが押 さ れた時にサーバーで 関数 が実行される。 ・フォームの入力内容を 受 け取り処理をでき る。 ・onAction関数にRuby を 実行するコードを書 く 引
用:https://future-architect.github.io/articles/20231130a
wasm
WebAssembly とは何か この機能はウェブプラットフォームにとって大きな意味を持ちま す。ウェブ上で動作するクライアントアプリで従来は実現できな かった、ネイティブ水準の速度で複数の言語で記述されたコー ドをウェブ上で動作させる方法を提供します。 今回はサーバー側でWasmを実行しています。 https://developer.mozilla.org/ja/docs/WebAssembl y/Concepts
@ruby/wasm-wasi ・先ほどのonAction関数内のコー ド。 ・npmでインストールできる。 ・wasmを読み込んでユーザーから 受け取ったコードを実行する。 ・Rubyで標準入力を与え、標準 出 力を取得するコードを追加す る。
終わりに
感想 • 意外と簡単に実装できた • Next.js 14 の新しい機能 Server Actions を使ってみたが、
便利そうな気がする • OHMORIYUSUKE/ruby-web でコードを公開しているので 見てください! • 作ってみると楽しい
ご清聴ありがとうございました🙇