Tutorial Solid Js dan Laravel #2 : Installasi dan Konfigurasi Solid Router

SantriKoding Indonesia
18 Mar 202409:44

Summary

TLDRThis video tutorial guides viewers on installing and configuring Solid Router for a Solid JS project. It covers the basics of Solid Router, inspired by Ember and React Router, and its necessity for SPA navigation. The process includes installation, integrating CSS frameworks for UI, modifying HTML and JavaScript files, and creating route templates. The tutorial also explains setting up route files and registering routes globally for navigation. Finally, it demonstrates testing the setup by accessing different routes locally.

Takeaways

  • 😀 The video is a tutorial on installing and configuring Solid Router in a Solid JS project.
  • 🛠️ Solid Router is inspired by Ember and React Router, and is officially developed as a library for Solid JS.
  • 📚 The tutorial starts with an explanation of what Solid Router is and its relation to Ember and React Router.
  • 💻 The first step in the tutorial is to install Solid Router in a Solid JS project.
  • 🔍 After installation, the audience is instructed to check the 'package.json' file for the added dependency.
  • 🌐 The tutorial then guides on integrating CSS frameworks like Bootstrap for a faster user interface development.
  • 📝 Code modifications in 'index.html' are demonstrated to include Bootstrap CSS and custom styles.
  • 🏗️ The creation of a template root is explained, involving editing 'app.jsx' within the 'src' folder.
  • 📁 The audience is guided to create pages like 'home', 'post index', 'create', and 'edit' within the 'src/pages' directory.
  • 🗺️ The tutorial covers setting up routing by creating a 'routes' folder and an 'index.jsx' file to define route paths and components.
  • 🔄 The final steps involve configuring the routing globally in the project by editing the 'src/index.jsx' file and wrapping the application with the 'Router' component.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is how to install and configure Solid Router in a Solid JS project.

  • What is Solid Router?

    -Solid Router is a library officially developed from Solid JS, used for creating navigation in a single page application.

  • What is the inspiration behind Solid Router?

    -Solid Router is inspired by Ember's router and React's router.

  • How can you check if Solid Router has been successfully installed?

    -You can check if Solid Router has been successfully installed by looking at the 'dependencies' section in the package.json file.

  • What is the first step in setting up Solid Router according to the video?

    -The first step is to install Solid Router in the Solid JS project by running a specific command in the terminal.

  • Why is it suggested to integrate CSS Bootstrap after installing Solid Router?

    -It is suggested to integrate CSS Bootstrap to make the user interface development faster and more efficient.

  • What changes are made to the index.html file during the setup process?

    -Changes include updating the title, loading the Bootstrap CSS, and creating custom styles for the body background and font.

  • Where is the template root located in the project?

    -The template root is located in the app.jsx file within the src folder.

  • What does the 'children' parameter in the app.jsx function represent?

    -The 'children' parameter represents the views or pages that will be rendered within the template.

  • How are new pages created in the project?

    -New pages are created by making folders within the 'pages' folder in the 'src' directory, and then creating .jsx files within those folders.

  • What is the purpose of creating a 'routes' folder and an 'index.jsx' file within it?

    -The 'routes' folder and 'index.jsx' file are created to define the routing configuration, mapping URLs to specific components.

  • How do you register the routes globally in the project?

    -You register the routes globally by importing and wrapping them in the router from Solid Router in the index.jsx file within the src folder.

  • What is the final step to test the routing setup?

    -The final step is to access the homepage or other defined routes via localhost:3000 and check if the corresponding pages are displayed correctly.

Outlines

00:00

🛠️ Installing and Configuring Solid Router

This paragraph introduces the process of installing and configuring Solid Router within a Solid JS project. It begins by explaining what Solid Router is, mentioning its inspiration from Ember and React routers. The script then guides the viewer to install Solid Router using a terminal command and checking the 'package.json' file for successful installation. After installation, viewers are instructed to integrate CSS Bootstrap for a quicker user interface setup. The tutorial continues with modifying the 'index.html' file to include Bootstrap CSS and custom styles for the body background and fonts. The viewer is then directed to create a template in 'app.jsx' within the 'src' folder, explaining the function and its parameters, particularly the 'children' prop which represents the view or page to be rendered within the template.

05:00

📂 Creating Pages and Setting Up Routing

The second paragraph details the creation of pages and setting up routing in a Solid JS project. It instructs viewers to create a 'Pages' folder within 'src' and then folders for 'Home', 'Post', 'PostIndex', 'PostCreate', and 'PostEdit'. Each of these folders contains an 'index.jsx' file with specific code. The paragraph then explains how to create a 'routes' folder with an 'index.jsx' file where routing is configured by importing the 'root' from Solid Router and the previously created pages. The routing setup is described, showing how different components are rendered based on the URL accessed. The tutorial concludes with instructions to register the routes globally in the project by modifying the 'index.jsx' file in the 'src' folder, wrapping the routes with the 'Router' component from Solid Router. The final step is to test the routing by accessing different URLs in the browser, which should display the corresponding pages.

Mindmap

Keywords

💡Solid Router

Solid Router is a library developed for Solid JS, inspired by Ember's and React's routing solutions. It is used to create navigation for single-page applications. In the video, the presenter discusses how to install and configure Solid Router within a Solid JS project, highlighting its importance in managing SPA navigation.

💡Installation

Installation refers to the process of adding new software, libraries, or tools to a project. In the context of the video, the presenter demonstrates how to install Solid Router in a Solid JS project by running a command in the terminal, which is a typical step in setting up project dependencies.

💡Configuration

Configuration is the process of setting up and adjusting the parameters of a system or application. In the video, after installing Solid Router, the presenter shows how to configure it within the project by integrating CSS Bootstrap to streamline the user interface development.

💡Single Page Application (SPA)

A Single Page Application is a web application that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. The video's theme revolves around creating an SPA using Solid Router, which facilitates seamless navigation without full page reloads.

💡Package.json

Package.json is a file that contains metadata for projects using Node.js and the npm registry. In the video, the presenter checks the 'package.json' file to confirm the successful installation of Solid Router by looking for its addition under the dependencies section.

💡CSS Bootstrap

CSS Bootstrap is a popular front-end framework that provides responsive design and pre-built components. The video mentions integrating CSS Bootstrap to speed up the development of the user interface in the Solid JS project.

💡Routing

Routing is the process of defining paths (or routes) that users can navigate through in an application. The video provides a step-by-step guide on creating routes for different pages such as home, post index, post create, and post edit using Solid Router.

💡Template

A template in web development is a reusable file that defines the structure and layout of a page. In the video, the presenter instructs on creating a template file 'app.jsx' within the 'src' folder, which serves as the parent template for the SPA.

💡Component

In the context of web development, a component is a self-contained piece of code that represents a part of the user interface. The video describes creating components for different views like home, post index, post create, and post edit, which are then rendered within the SPA's template.

💡Props

Props are a way to pass data from a parent component to a child component in React and similar frameworks like Solid JS. The video mentions 'props' in the context of the 'children' parameter within a component function, which represents the view or page to be rendered within the template.

💡Index.jsx

Index.jsx refers to a file that is often used as the entry point for a folder of React or Solid JS components. The video script describes creating 'index.jsx' files within different pages like 'home' and 'post' to define the content and behavior of those pages in the SPA.

Highlights

Introduction to Solid Router and its inspiration from Ember and React Routers.

Solid Router is an official library developed for Solid JS for creating SPA navigation.

Instructions on how to install Solid Router in a Solid JS project.

Verification of successful installation by checking the package.json dependencies.

Integration of CSS Bootstrap for a faster user interface development.

Modification of the index.html file to include Bootstrap CSS and custom styles.

Creation of a template root in the app.jsx file within the src folder.

Explanation of the 'children' parameter in the root function for rendering views or pages.

Instructions to create a new 'Pages' folder and a 'Home' subfolder within the 'src' directory.

Creation of an 'index.jsx' file in the 'Home' folder with specific code.

Creation of 'Post' related pages like 'PostIndex', 'Create', and 'Edit'.

Instructions to create a 'Routes' folder and an 'index.jsx' file for defining routes.

Importing the root from Solid Router and previously created pages in the routes file.

Defining routes with corresponding URLs and components to be rendered.

Instructions to register routes globally within the project.

Modification of the 'index.jsx' file in the 'src' folder to import and register routes.

Wrapping the routes with the 'Router' component for global accessibility.

Instructions to test the routing by accessing different URLs and observing the rendered pages.

Preview of the final project with routing in action, showcasing navigation between pages.

Anticipation of future tutorials on displaying data from a Laravel API in Solid JS.

Transcripts

play00:00

Halo teman-teman semuanya pada video

play00:02

kali ini kita semua akan belajar

play00:04

bagaimana cara melakukan instalasi dan

play00:06

konfigurasi Solid router di dalam

play00:09

Project Solid JS Oke Langsung

play00:11

teman-teman buka di sini ya artikel yang

play00:13

kedua sini eh apa itu solid router ya

play00:16

Solid router itu sebenarnya dibangun ya

play00:19

terinspirasi dari Eh

play00:21

ember ya Eh ember routing dan juga react

play00:24

router ya di sini teman-teman bisa buka

play00:26

ee apa namanya ee github e repositorynya

play00:31

Nah untuk penjelasannya sendiri yaitu

play00:33

merupakan sebuah library yang secara

play00:36

ofisial dikembangkan dari Solid JS yang

play00:39

digunakan untuk membuat sebuah navigasi

play00:42

secara spa atau single page

play00:45

application ya di sini Ya seperti yang

play00:47

saya bilang tadi solet ini diciptakan

play00:49

karena terinspirasi oleh ember router

play00:51

dan react router ya oke di sini langkah

play00:56

yang pertama adalah melakukan instalasi

play00:58

Solid router di dalam Project sol JS oke

play01:01

di sini saya akan menjalankan perintah

play01:02

seperti

play01:03

ini Nah nanti ya jika proses instalasi

play01:07

berhasil kita teman-teman bisa nih cek

play01:09

di dalam file package.json ya di sini P

play01:13

pada bagian dependensi Nah sudah kalau

play01:15

sudah berhasil nanti akan eh tertambah

play01:18

seperti ini ya

play01:19

Eh saya akan buka projectnya terlebih

play01:22

dahulu di sini saya akan Eh stop dulu

play01:26

oke Nah di sini

play01:28

ya

play01:35

oke di sini saya akan jalankan

play01:38

lagi ya Jadi nanti di sini di file

play01:41

package Jion di sini kan e bagian

play01:43

dependeny masih eh Solid JS itu sendiri

play01:46

nanti jika instalasi berhasil nanti akan

play01:48

e ditambahkan seperti ini ya kita akan

play01:51

instal ini teman-teman silakan Buka

play01:54

terminal di vs code-nya dan kita

play01:57

jalankan nah jika berhasil Nah di sini

play02:00

ya sudah ditambahkan artinya ee Project

play02:03

ee ee routernya Ini sudah berhasil

play02:08

terinstal Setelah itu kita disuruh

play02:10

melakukan inst eh integrasi CSS bootrap

play02:13

untuk membuat user Inter user

play02:15

interface-ennya biar e lebih cepat aja

play02:17

ya di sini teman-teman bebas menggunakan

play02:19

apapun ya misalkan Tail Win CH s dan

play02:22

lain sebagainya Nah karena biar lebih

play02:24

sederhana aja kita akan menggunakan eh

play02:27

framew dari e bra CSS Ya silakan

play02:30

teman-teman buka file index.html

play02:33

teman-teman silakan ubah semua kodenya

play02:34

menjadi seperti ini

play02:36

ya sini teman-teman buka

play02:39

index.atml ya di sini kita ganti semua

play02:42

seperti ini Nah titelnya kita ganti

play02:44

kemudian kita load Apa namanyastrap-nya

play02:47

itu sendiri ya css-nya kemudian di sini

play02:49

ada javascript-nya dan di sini kita

play02:51

membuat custom Style ya untuk e

play02:53

background E body-nya kemudian font-nya

play02:57

juga kita akan ubah kita save

play03:01

Oke Setelah itu kita disuruh membuat

play03:04

sebuah induk liot ya jadi e template

play03:07

induknya ya di sini e letaknya ada di e

play03:11

file

play03:12

app.jsx yang berada di dalam folder src

play03:15

Nah kita akan copy di

play03:17

sini kemudian teman-teman Buka di sini

play03:20

ya Eh src app.jsx nah secara default

play03:24

bawnya seperti ini kita akan ee ubah

play03:26

Semua menjadi seperti ini Nah di sini ya

play03:28

teman-teman perhatikan pada function up

play03:31

ya di sini fun komponennya di dalamnya

play03:33

ada parameter children di sini ya ini

play03:36

props yang merupakan e nanti berupa view

play03:40

atau page yang akan dirender e di dalam

play03:43

template ini ya Jadi kita menerima

play03:45

parameter seperti ini Nah nanti kita

play03:47

tinggal render aja seperti ini untuk e

play03:51

view atau PX yang menggunakan komponen

play03:54

ini apa E induk template ini Oke kita

play03:57

save kemudian setelah itu Ya kita

play04:02

disuruh membuat pex ya Yang nanti akan

play04:05

kita gunakan eh seperti homepage post

play04:08

index post create dan posst e edit ya di

play04:11

sini yang pertama kita disuruh membuat

play04:13

eh halaman pack home ya di sini Kita

play04:16

disuruh membuat eh folder yang bernama

play04:18

Page di dalam folder src nah kemudian di

play04:21

dalam folder page tersebut kita disuruh

play04:23

membuat folder yang bernama home nah di

play04:26

dalam folder home ini kita disuruh

play04:28

membuat file yang bernama index . jsx

play04:30

dan kita masukkan kode berikut ini ya

play04:33

kita copy di sini kodenya teman-teman ya

play04:36

di sini kita ikuti di dalam folder src

play04:39

Ya teman-teman silakan buat folder baru

play04:41

bernama pegas seperti ini kemudian di

play04:43

dalamnya kita buat home kemudian di

play04:46

dalam folder home di sini Klik Kanan

play04:49

buat file namanya

play04:51

index.jsx dan kita masukkan kode seperti

play04:54

ini

play04:56

Oke Setelah itu kita disuruh membuat pex

play05:00

untuk post index ya sama caranya di sini

play05:02

Ee kita membuat folder post di dalam src

play05:05

pegas di dalamnya kita buat indek dan

play05:08

isinya adalah ini ya nanti ini adalah e

play05:11

untuk sementara ya adalah default e UI

play05:14

yang kita miliki nanti akan kita ubah di

play05:16

tutorial-tutorial berikutnya nah ini

play05:18

buat pengetesan saja nantinya sini kita

play05:21

buat ya

play05:23

eh B seperti ini kemudian di dalamnya

play05:26

kita buat file

play05:28

index. SX seperti ini kita masukkan nah

play05:32

ini default-nya nanti kita akan

play05:33

ubah-ubah lagi kemudian di sini untuk

play05:35

creit-nya sama

play05:40

caranya

play05:42

creit.csx

play05:44

ya Kemudian untuk edit e juga

play05:48

sama sini

play05:52

edit jsx

play05:55

oke nah Setelah itu kita akan melakukan

play05:59

figurasi atau membuat routingnya ya di

play06:01

dalam e project sol JS Nah di sini

play06:05

teman-teman disuruh membuat folder baru

play06:07

dengan nama rotes nah di dalam folder

play06:09

rotes ini kita disuruh membuat file

play06:11

dengan nama index.jsx dan kita masukkan

play06:14

kode berikut ini dan saya akan Jelaskan

play06:17

Oke kita copy Nah di sini saya akan

play06:20

close semua dulu biar gak bingung ya src

play06:24

teman-teman buat folder baru namanya R

play06:27

seperti ini kemudian dinya kita buat

play06:30

namanya

play06:31

index.jsx seperti ini nah kemudian kita

play06:33

eh pastai seperti ini Nah di sini yang

play06:37

pertama kita impor root ya dari Solid

play06:40

router Kemudian yang kedua Eh kita impor

play06:43

empat e pex yang sudah kita buat

play06:45

sebelumnya di sini ada pex home kemudian

play06:47

ada post index eh pex index eh create

play06:52

dan edit Nah di sini ya ada empat ini

play06:54

yang kita impor nah kemudian di sini

play06:56

untuk membuat sebuah Har Ya di soled

play06:59

kita kita cukup menggunakan seperti ini

play07:01

root ya di sini pad-nya adalah url-nya

play07:04

apa di sini dan ini komponen yang akan

play07:07

dirender ketika eh url ini diakses jadi

play07:10

nanti ketika kita mengakses halaman Home

play07:13

atau slash ya maka komponen Home atau

play07:16

pex home nanti di sini ya Akan dirender

play07:20

Kemudian untuk post ya di sini slash po

play07:22

maka post index akan dirender create

play07:25

seperti itu dan seterusnya Oke cukup

play07:28

mudah sekali dan sangat S simpel sekali

play07:30

untuk membuat sebuah routing di eh

play07:32

Project soled E menggunakan solet router

play07:35

ya setelah membuat eh routing seperti

play07:38

ini ya kemudian kita disuruh melakukan

play07:41

register rout tersebut biar terbaca

play07:43

secara global di dalam projjectnya Nah

play07:46

di sini untuk melakukan konfigurasi

play07:47

tersebut kita disuruh mengubah file yang

play07:50

bernama index.jsx di dalam folder src

play07:53

Nah di sini ya jadi di sini nanti kita e

play07:56

impor roots-nya yang sudah kita buat

play07:58

tadi kemudian di sini kita register di

play08:00

sini ya kita copy semuanya seperti ini

play08:05

kemudian teman-teman masuk

play08:08

index.jsx di sini kita ubah semua Nah

play08:11

kita tetap e apa ini namanya eh impor

play08:15

router dari Solid router nanti ini buat

play08:17

wrapping ya untuk membungkus roots yang

play08:19

sini ya Jadi kita impor ini dari Solid

play08:22

router ini file yang kita buat tadi

play08:25

rotesnya kemudian di sini ya teman-teman

play08:27

bisa perhatikan routernya kita di

play08:29

digunakan untuk membungkus rotes yang

play08:31

ini ya Kemudian untuk road app-nya

play08:34

adalah ee ini ya Do adalah file yang ini

play08:39

app.jsx atau induk template-nya tadi oke

play08:42

kurang lebih seperti itu aja ya jadi

play08:44

menambahkan ini ini dan kita ubah di

play08:47

dalam rendernya seperti ini aja sangat

play08:48

simpel sekali kemudian kita simpan

play08:52

setelah itu nah kita tinggal uji coba

play08:55

nih Eh ee mengakses slash eh Slash apa

play08:59

url/ash ya atau homepage-nya dengan

play09:02

local host 3000 seperti ini nah jika

play09:04

berhasil nanti akan menampilkan seperti

play09:05

ini jika teman-teman klik menu pos maka

play09:07

akan menampilkan ee halaman seperti ini

play09:10

ya kita lihat di sini nah kurang lebih

play09:13

sudah berubah seperti ini ya kemudian

play09:15

kita klik post nah kurang lebih seperti

play09:17

ini ya sangat cepat sekali eh

play09:19

menggunakan Solid JS ini Oke kurang

play09:22

lebih seperti itu ya di video kali ini

play09:25

bagaimana cara instalasi dan konfigurasi

play09:28

Solid router di dalam Project solet JS

play09:30

nah di video berikutnya kita akan

play09:33

belajar bagaimana cara menampilkan data

play09:35

di soled dari race api yang dibuat

play09:38

menggunakan laravet terima

play09:43

kasih

Rate This

5.0 / 5 (0 votes)

الوسوم ذات الصلة
Solid JSRouter SetupSPA DevelopmentWeb TutorialCoding GuideProject SetupFrontend FrameworkJavaScript LibraryWeb DevelopmentTutorial Video
هل تحتاج إلى تلخيص باللغة الإنجليزية؟