1603252800
Welcome to my Computer related Youtube channel, I have launched this channel to share with you all the things I have learned so far in web development, networking, programming and all the aspects that I am interested in concerning the computer world
#webdev
1603252800
Welcome to my Computer related Youtube channel, I have launched this channel to share with you all the things I have learned so far in web development, networking, programming and all the aspects that I am interested in concerning the computer world
#webdev
1639724168
After learning the basics of web development, you probably want to learn more advanced techniques to improve your website. Enhancing interactions is one way to do this. The most common ones include animations, hovering on buttons, and swiping. In this tutorial, we will learn how to integrate 3D into your React website using Three.js.
Three.js is a cross-browser JavaScript library and application programming interface (API) used to create and display animated 3D computer graphics in a web browser using WebGL.
You can find the initial code:
https://codesandbox.io/s/three-js-initial-x3ojl
The final code: https://codesandbox.io/s/three-js-final-5phhd
00:00 Intro to Three.js
03:10 Dependencies
04:00 Box geometry
17:35 Animated Sphere
22:40 Import 3D models
#threejs #webdev #reactjs #react #webdev
1643255600
Prisma is an open-source ORM that makes it fun and safe to work with a database like MySQL, Postgres, SQL Server, or MongoDB. It generates a type-safe client library to provide an awesome DX in any Node.js or JavaScript project.
#database #webdev #100SecondsOfCode
๐ Resources
- Prisma Docs https://www.prisma.io/
- Prisma Source Code https://github.com/prisma/prisma
๐ Topics Covered
- What is Prisma
- Is Prisma an ORM?
- Prisma Quickstart
- What is Prisma used for?
- How to use Prisma in Node.js
- Using Prisma with a relational database
- Prisma compared to Sequalize or TypeORM
#prisma #database #webdev
1658653740
์ด ํํ ๋ฆฌ์ผ์์๋ SvelteKit์ผ๋ก ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ๊ฒ ๋ฉ๋๋ค. Netlify์ Sveltekit ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ฐฐํฌํฉ๋๋ค. Sapper์์ Sveltekit์ผ๋ก ์ ํํ๋ ์ด์ ์ Sveltekit์์ REST API๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ
svelte์ ํ์ ๋ช ๋ฌ ์ ์ Sveltekit์ ์๊ฐํ์ต๋๋ค. Sapper๋ฅผ ๋์ฒดํ๋ ์๋ก์ด ํ๋ ์์ํฌ์ ๋๋ค. ์๋ฆ๋ค์ด ๊ฐ๋ฐ ๊ฒฝํ๊ณผ ์ ์ฐํ ํ์ผ ์์คํ ๊ธฐ๋ฐ ๋ผ์ฐํ ์ผ๋ก ๋ ๋ ตํ ์ฑ์ ๋น๋ํ๋ ๊ฐ์ฅ ๋น ๋ฅธ ๋ฐฉ๋ฒ์ ๋๋ค. ์ด ๊ธฐ์ฌ์์๋ ํ๋ ์์ํฌ์์ ํ์ํ ๋ชจ๋ ์ ๋ฐ์ดํธ๋ก ์ํ ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ์ฌ Sveltekit์ด ์ด๋ป๊ฒ ์๋ํ๋์ง ์ดํด๋ณผ ๊ฒ์ ๋๋ค. Sveltekit์ผ๋ก ์น ์ฑ ๊ตฌ์ถ์ ๋ํ ๋ชจ๋ ๊ธฐ๋ณธ ๊ฐ๋ , Sapper์์ Sveltekit์ผ๋ก ์ ํํ๋ ์ด์ , ์ฑ ๋ด์ ๋ฐ๋ชจ ๋ธ๋ก๊ทธ๋ฅผ ๊ตฌ์ถํ์ฌ Sveltekit์์ REST API๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ๊ฒ ๋ฉ๋๋ค. ๋ํ Netlify์์ Sveltekit ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ๊ฒ ๋ฉ๋๋ค.
svelte ์น์ฌ์ดํธ ์ ๋ฐ๋ฅด๋ฉด Svelte๋ฅผ ์ฒ์ ์ฌ์ฉํ๋ ์ฌ๋๋ค์ ์ํด :
Svelte is a radical new approach to building user interfaces. Whereas traditional
frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that
work into a compile step that happens when you build your app.
Instead of using techniques like virtual DOM diffing, Svelte writes code that surgically
updates the DOM when the state of your app changes.
Svelte is a component-based Javascript framework - much like React, Vue, or angular and is
used for building web applications in Javascript.
๋ฐ๋๋ก Sveltekit์ ๋ชจ๋ ํฌ๊ธฐ์ ๋ฉ์ง ์ฑ์ ๋น๋ํ๊ธฐ ์ํ ํ๋ ์์ํฌ์ ๋๋ค. ๋ ์์ ์ค์น ๊ณต๊ฐ์ผ๋ก ๋ ์ค์ํ ์ฑ์ ๋น๋ํ ์ ์์ต๋๋ค. ์๋ฆ๋ค์ด ๊ฐ๋ฐ ๊ฒฝํ, ์ ์ฐํ ํ์ผ ์์คํ ๊ธฐ๋ฐ ๋ผ์ฐํ , SSR(์๋ฒ ์ธก ๋ ๋๋ง), ํด๋ผ์ด์ธํธ ์ธก ์ํ ๋ฐ ๊ธฐํ ๊ณ ์ ๊ธฐ๋ฅ์ด ํจ๊ป ์ ๊ณต๋ฉ๋๋ค.
Svelte์ ์ฐฝ์์์ธ Richard Harris๋ Sapper์์ sveltekit์ผ๋ก์ ์ ํ์ ์ํฅ์ ๋ฏธ์น ๋ช ๊ฐ์ง ์ด์ ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ์ธ๊ธํฉ๋๋ค.
Sveltekit์ ์ต์ ์น ์ฑ ๊ตฌ์ถ์ ๋ชจ๋ ๋ณ๋ชฉ ํ์์ ์ ๊ฑฐํฉ๋๋ค. ์ฐฝ์์ ์ธ ๋ถ๋ถ์ ์ง์คํ๋ ๋์ ์ง๋ฃจํ ์์ ์ ๋ชจ๋ ์ํํฉ๋๋ค. ์ต์ ์น์ฉ์ผ๋ก ์ค๊ณ๋ ๋ฒ๊ฐ์ฒ๋ผ ๋น ๋ฅธ ํ๋ก ํธ์๋ ๋น๋ ๋๊ตฌ์ธ Snowpack under the hood ์ ์ํด ๊ตฌ๋๋ฉ๋๋ค . Vite with Svelte ํ๋ฌ๊ทธ์ธ ์ ์ฌ์ฉ ํ์ฌ HMR(Hot Module Replacement)์ ํตํด ๋ฒ๊ฐ์ฒ๋ผ ๋น ๋ฅด๊ณ ๊ธฐ๋ฅ์ด ํ๋ถํ ๊ฐ๋ฐ ๊ฒฝํ์ ์ ๊ณตํฉ๋๋ค. ์ฝ๋ ๋ณ๊ฒฝ ์ฌํญ์ ๋ธ๋ผ์ฐ์ ์ ์ฆ์ ๋ฐ์๋ฉ๋๋ค.
Sveltekit์ผ๋ก ํ๋ก์ ํธ๋ฅผ ์ค์ ํ๋ ค๋ฉด ์ปดํจํฐ์ NodeJS๊ฐ ์ค์ ๋์ด ์์ด์ผ ํฉ๋๋ค. ์๋ ๋ช ๋ น์ ์คํํ์ฌ sveltekit ๋ฐ๋ชจ ํ๋ก์ ํธ๋ฅผ ์ค์บํด๋ํ ๋ค์ ํด๋๋ก ์ด๋ํ์ฌ ํ์ํ ๋ชจ๋ ์ข ์์ฑ์ ์ค์นํ์ธ์.
npm init svelte@next my_portfolio_website
cd my_portfolio_website
npm install
npm run dev
์ฒซ ๋ฒ์งธ ๋ช ๋ น์ 'my_portfolio_website' ๋๋ ํ ๋ฆฌ์ ์๋ ์ ํ๋ก์ ํธ๋ฅผ ์ค์บํด๋ฉํ์ฌ TypeScript์ ๊ฐ์ ๋ช ๊ฐ์ง ๊ธฐ๋ณธ ๋๊ตฌ๋ฅผ ์ค์ ํ ๊ฒ์ธ์ง ๋ฌป๋ ๋ฉ์์ง๋ฅผ ํ์ํฉ๋๋ค. ์ด ํ๋ก์ ํธ์์๋ Typescript๋ฅผ ์ฌ์ฉํ์ง ์์ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ '์๋์ค'๋ฅผ ์ ํํ์ญ์์ค. ํ์ ๋ช ๋ น์ ์ข ์์ฑ์ ์ค์นํ๊ณ localhost:3000 ์์ ์๋ฒ๋ฅผ ์์ํฉ๋๋ค .
์๋๋ ์ฐ๋ฆฌ๊ฐ ๋ง๋ค๊ณ ์๋ ์ํ ๋ฐ๋ชจ์ ๋๋ค.
์ด ๊ธฐ์ฌ๋ฅผ ๋ฐ๋ผ ํ๊ธฐ ์ํด GitHub repo ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค .
Sveltekit์ ํ์์ ์ธ ๊ธฐ๋ฅ ์ค ํ๋๋ ํ์ผ ์์คํ ๊ธฐ๋ฐ ๋ผ์ฐํฐ ์ ๋๋ค. ์ด๋ ์ฝ๋๋ฒ ์ด์ค์ ๊ตฌ์กฐ๊ฐ ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ตฌ์กฐ๋ฅผ ์ ์ํ๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค. ํ์ด์ง์ ์๋ํฌ์ธํธ๋ผ๋ ๋ ๊ฐ์ง ์ ํ์ ๊ฒฝ๋ก๊ฐ ์์ต๋๋ค. ํ์ด์ง๋ ์ผ๋ฐ์ ์ผ๋ก ํ์ด์ง๊ฐ ์ฌ์ฉ์์๊ฒ ํ์๋๋ ๋ฐ ํ์ํ HTML, CSS ๋ฐ JavaScript๋ฅผ ์์ฑํ๋ ๋ฐ๋ฉด Endpoints๋ ์๋ฒ์์๋ง ์คํ๋ฉ๋๋ค(๋๋ ์ฌ์ ๋ ๋๋ง ์ ๊ฒฝ์ฐ ์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ ๋ ).
๋ค๋ฅธ ๊ตฌ์ฑ ์์ ๊ธฐ๋ฐ ํ๋ ์์ํฌ์ ๋ง์ฐฌ๊ฐ์ง๋ก Pages๋ .svelte
ํ์ผ(๋๋ config.extension ์ ๋์ด๋ ํ์ฅ๋ช
์ ๊ฐ์ง ํ์ผ๋ก ์์ฑ๋ Svelte ๊ตฌ์ฑ ์์์
๋๋ค . ์ฌ์ฉ์๊ฐ ์ ํ๋ฆฌ์ผ์ด์
์ ์ฒ์ ๋ฐฉ๋ฌธํ๋ฉด ๊ธฐ๋ณธ์ ์ผ๋ก ํด๋น ํ์ด์ง์ ์๋ฒ ๋ ๋๋ง ๋ฒ์ ์ด ์ ๊ณต๋ฉ๋๋ค. ๊ฑฐ๊ธฐ์์ ๋ค๋ฅธ ํ์ด์ง๋ก์ ํ์์ ์ ์ ์ผ๋ก ํด๋ผ์ด์ธํธ๊ฐ ์ฒ๋ฆฌํฉ๋๋ค.
ํ์ผ ์ด๋ฆ์ ๊ฒฝ๋ก๋ฅผ ๊ฒฐ์ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, src/routes/index.svelte ๋ ๋ฐ๋ชจ ์ฌ์ดํธ์ ๋ฃจํธ์ ๋๋ค.
์ ํํ ์ฝ๋ ํธ์ง๊ธฐ๋ก ํ๋ก์ ํธ ํด๋๋ฅผ ์ด๊ณ src/routes/index.svelte ๋ก ์ด๋ํฉ๋๋ค . ์๋์ ๋ค์ ์ฝ๋๋ฅผ ์ฝ์ ํ์ญ์์ค.
<!-- src/routes/index.svelte -->
<svelte:head>
<title>David Adeneye</title>
</svelte:head>
<div class="container">
<div class="info">
<div class="animate-background">
<div class="container info-container">
<div class="info-text">
<h1,
<p class="animate-text-1">School-taught Computer Scientist,</p>
<p class="text-2">Self-taught Software Engineer</p>
</h1>
</div>
<h2 class="subtitle">
On a mission to help SMEs across the globe do businesses
seamlessly and digitally.
</h2>
<div style="color:black" class="scroll-button animate-scroll" tabindex="0">
<a href="/about">Click Here</a><div class="arrow">โ</div>
</div>
</div>
</div>
</div>
</div>
<div class="background-div"></div>
๋ ๋ฒ์งธ ์ค ์ <svelte:head>
ํ๊ทธ ์์๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฌธ์ ๋ด๋ถ์ ์์๋ฅผ ์ฝ์
ํ ์ ์์ต๋๋ค. ๋๋จธ์ง ์ฝ๋๋ ์ธ๋ฑ์ค ํ์ด์ง์ ๋ํ HTML ํ์ด์ง ๊ตฌ์กฐ์
๋๋ค. ๋ค์ ์น์
์์๋ Sveltekit์์ ์คํ์ผ๋ง์ด ์ด๋ป๊ฒ ์๋ํ๋์ง ์ดํด๋ณผ ๊ฒ์
๋๋ค.<head>
Sveltekit์ ์คํ์ผ๋ง ์์ ๋ฐฉ์์ ์ผ๋ฐ HTML&CSS ํ๋ก์ ํธ์ ๊ฑฐ์ ๋์ผํ ํ๋ก์ธ์ค์ ๋๋ค. app.html ์ head ํ๊ทธ์์ ๋ชจ๋ ํ์ด์ง์ ์ ์ฉ๋ ์ธ๋ถ CSS ํ์ผ ๋๋ ๋ฃจํธ ์คํ์ผ์ ์ฐธ์กฐ ํ๊ณ ๋ฌธ์ ํ๊ทธ์ ์ ํ๊ธฐ๋ฅผ ์ฒจ๋ถํ์ฌ ์คํ์ผ์ ์ ์ฉํ ์ ์์ต๋๋ค.
์ ์ index.svelte ํ์ผ ์คํ์ผ์ ์ง์ ํ๋ ค๋ฉด ๋ง์ง๋ง ์ฝ๋ ์๋์ ๋ค์ ์คํ์ผ์ ์ถ๊ฐํ์ธ์.
<style>
.info {
text-align: center;
position: relative;
}
.info-container {
height: 100%;
display:flex;
flex-direction: column;
justify-content: center;
text-align: left;
align-items: start;
}
.container {
max-width: 1400px;
margin: 190px 0 0 2.5rem;
}
.info h1 {
font-size: 4rem;
margin: 0;
}
.info h1 p {
position: relative;
font: inherit;
margin: 0;
text-align: left;
line-height: 130%;
width: fit-content;
font-weight: 800;
letter-spacing: -0.03em;
}
.info h2 {
max-width: 65ch;
font-weight: 200;
margin-top: 0.50rem;
}
.background-div {
background-color: var(--background);
width: 100%;
height: 56vh;
margin: -155px auto;
}
.info .info-text {
position: relative;
}
.scroll-button {
display: flex;
border: none;
outline: none;
cursor: pointer;
}
.scroll-button .arrow {
margin-left: 0.50rem;
}
</style>
๋ํ ๋ค๋ฅธ ํ์ด์ง์์ ๊ธ๋ก๋ฒ ์คํ์ผ ์ง์ ์ด ์๋ํ๋๋ก ํ๋ ค๋ฉด app.html์ ์ด๊ณ html ๋ซ๋ ํ๊ทธ ์๋์ ๋ค์ ์คํ์ผ์ ์ฝ์ ํฉ๋๋ค.
<style>
body {
background-position: left top;
font-family: "Inter", sans-serif;
margin: 0;
background-repeat: no-repeat;
}
* {
box-sizing: border-box;
}
a {
text-decoration: none;
color: black;
}
:root{
--background: #ecebe8;
}
nav {
position: sticky;
top: 0;
left: 0;
right: 0;
margin: 0 80px 0 80px;
padding-top: 2rem;
padding-bottom: 2rem;
}
nav .nav-container {
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-links {
display: flex;
justify-content: flex-end;
align-items: center;
margin: -1em 0;
flex: 1 0 auto;
}
.nav-links .link {
position: relative;
margin: 1em;
font-size: 0.85rem;
letter-spacing: 1px;
color: black;
}
.nav-logo {
position: relative;
line-height: 1;
font-size: 1.1rem;
color: black;
}
</style>
๋ํ Svelte์์ ๊ตฌ์ฑ ์์๋ฅผ ๊ฐ์ ธ์ฌ ๋ ๊ฐ ๊ตฌ์ฑ ์์ ์คํ์ผ ์ง์ ์ ๋ด๋ถ์ ์ผ๋ก ๋ฒ์๊ฐ ์ง์ ๋ฉ๋๋ค. ์ฆ, ๊ฐ์ ธ์จ ๊ตฌ์ฑ ์์์ ์ ์ฉ๋ ์คํ์ผ์ ๊ตฌ์ฑ ์์ ์์ฒด์๋ง ์ํฅ์ ์ค๋๋ค.
์์์ ์ค๋ช ํ ๊ฒ์ฒ๋ผ ํ์ด์ง๋ ์์ ํ ๋ ๋ฆฝ ์คํํ ๊ตฌ์ฑ ์์๋ก ์ฒ๋ฆฌ๋ฉ๋๋ค. ๋ฐ๋ผ์ ํ์ ์ ๊ธฐ์กด ๊ตฌ์ฑ ์์๊ฐ ์ ๊ฑฐ๋๊ณ ์ ๊ตฌ์ฑ ์์๊ฐ ์ธ๊ณ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ์์ ๋๋ ๊ตฌ์ฑ ์์๋ ํ์ ๋ฉ๋ด ๋๋ ๋ฐ๋ฅ๊ธ๊ณผ ๊ฐ์ ๋ง์ ์์ฉ ํ๋ก๊ทธ๋จ์ ๋ชจ๋ ํ์ด์ง์ ํ์๋์ด์ผ ํฉ๋๋ค. ๋ฐ๋ผ์ ๋ชจ๋ ํ์ด์ง์์ ๋ฐ๋ณตํ๋ ๋์ ๋ ์ด์์ ๊ตฌ์ฑ ์์๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์น์ฌ์ดํธ์ ๋ชจ๋ ํ์ด์ง์ ์ ์ฉ๋๋ ๋ ์ด์์ ๊ตฌ์ฑ ์์๋ฅผ ๋ง๋ค๋ ค๋ฉด src/routes/__layout.svelte ๋ผ๋ ํ์ผ์ ๋ง๋ค๊ณ ์๋์ ๋ค์ ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ์ต๋๋ค.
<!-- src/routes/__layout.svelte -->
<nav>
<div class="nav-container">
<a href="/" class="nav-logo" title="Back to Homepage">David Adeneye</a>
<div class="nav-links">
<a href="/about" class="link">About</a>
<a href="/blog" class="link">Blog</a>
<a href="/projects" class="link">Projects</a>
<a href="/contact" class="link">Contact</a>
</div>
</div>
</nav>
<div class="container">
<!-- Pages will be injected below -->
<slot></slot>
</div>
<style>
.container {
max-width: 1400px;
margin: 50px auto;
}
</style>
์์ ์ฝ๋๋ ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ์ ๋ชจ๋ ํ์ด์ง์ ์ ์ฉ๋๋ ํ์ ๋ฉ๋ด๋ฐ์ ๋๋ค. Sveltekit์ด ์ฌ์ฉํ๋ ๊ธฐ๋ณธ ๋ ์ด์์ ๊ตฌ์ฑ ์์๋ ํฌํจํ์ง ์์ ๊ฒฝ์ฐ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
<slot></slot>
๋ํ ์ํ๋ ๋งํฌ์
, ์คํ์ผ ๋ฐ ๋์์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ ์ผํ ์๊ตฌ ์ฌํญ์ ์์ __layout.svelte ํ์ผ<slot>
์์์ ๊ฐ์ด ๊ตฌ์ฑ ์์์ ํ์ด์ง ์ฝํ
์ธ ๊ฐ ํฌํจ๋์ด์ผ ํ๋ค๋ ๊ฒ ์
๋๋ค.
๋ค๋ฅธ ๋ชจ๋ ์ธ๊ธฐ ์๋ SSR ์๋ฃจ์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก Sveltekit์๋ ํ๋ฅญํ ํ์ผ ๊ธฐ๋ฐ ๋ผ์ฐํ ์์คํ ์ด ์์ต๋๋ค. ์ฑ์ ํ์ด์ง๋ ๊ธฐ๋ณธ์ ์ผ๋ก src/routes ํด๋์ ์ ์ฅ๋ฉ๋๋ค. ์ด๊ฒ์ ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ตฌ์กฐ๊ฐ ์ฝ๋๋ฒ ์ด์ค์ ๊ตฌ์กฐ, ํนํ src/routes ์ ๋ด์ฉ์ ์ํด ์ ์๋๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค .
ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ๋ ์ฝ 6ํ์ด์ง๋ก ๊ตฌ์ฑ๋์ด ์์ต๋๋ค.
index.svelte
(์์์ ์ด๋ฏธ ์์ฑ)about.svelte
(์ด ์น์
์์ ๋ง๋ค ๊ฒ์
๋๋ค)blog.svelte
(๋ค์ ์น์
์์ ๋ง๋ค ๊ฒ์
๋๋ค)projects.svelte
(github ์ ์ฅ์์ ์ฝ๋ ํ์ผ ๋ณต์ฌ)contact.svelte
(github ์ ์ฅ์์ ์ฝ๋ ํ์ผ ๋ณต์ฌ)์์ src/routes/__layout.svelte ์์ ์ด๋ฌํ ํ์ด์ง์ ๋ํ ํ์ ํค๋ ๊ตฌ์กฐ๋ฅผ ์์ฑํ๊ธฐ ๋๋ฌธ์ . about.svelte ๋ฅผ ์ด๊ณ ์๋์ ๋ค์ ์ฝ๋๋ฅผ ์ฝ์ ํ์ญ์์ค.
<!-- src/routes/about.svelte -->
<svelte:head>
<title>About</title>
</svelte:head>
<div class="main_container">
<section>
<div class="inner-container">
<h2 class="about-title">I'm David Adeneye๐</h2>
<div class="about-subtitle">
<p>
Software Engineer and a Technical Writer with a solid
background in Computer Science, I'm passionate about making
the web accessible for everyone. I design and develop visually compell ing applications with user-friendly interaction that drive business g owth and improve user experience. When I'm not solving problems,
I love to create technical content for engineers and tech
startups across the globe.
</p>
<p>
Creating magic daily on the internet. You can send me
an email at <span class="info-text">adeneyeabiodun@gmail.com</span>
</p>
</div>
</div>
</section>
</div>
<style>
.main_container {
margin: 0 80px 0 65px;
}
.about-title {
font-size: 4.2rem;
font-weight: bold;
margin-top: 11rem;
}
.about-subtitle {
margin-top: -2rem;
}
.about-subtitle >p {
width: 60%;
font-weight: normal;
font-size: 1rem;
line-height: 2rem;
}
.info-text {
font-style: italic;
font-weight: bold;
}
</style>
ํ์ ๊ตฌ์ฑ ์์๋ ํญ์ ํ์๋๋ฉฐ ํ์ด์ง ์ฌ์ด๋ฅผ ํด๋ฆญํ๋ฉด ํญ์ ํ์ด์ง ์ฝํ ์ธ ๊ฐ ๋ฐ๋๋๋ค. ์ด์ ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ๊ฐ ์๋ํ๋ ๋ชจ์ต์ ํ์ธํ์ญ์์ค. ๊ทํ์ ์ ๋ณด ํ์ด์ง๋ ๋ค์๊ณผ ๊ฐ์์ผ ํฉ๋๋ค.
OpenReplay ๋ ์ฌ์ฉ์๊ฐ ์น ์ฑ์์ ์ํํ๋ ์์ ์ ๋ณผ ์ ์๋ ์คํ ์์ค ์ธ์ ์ฌ์ ์ ํ๊ตฐ์ผ๋ก ๋ฌธ์ ๋ฅผ ๋ ๋นจ๋ฆฌ ํด๊ฒฐํ ์ ์๋๋ก ๋์์ค๋๋ค. OpenReplay๋ ๋ฐ์ดํฐ๋ฅผ ์๋ฒฝํ๊ฒ ์ ์ดํ ์ ์๋๋ก ์์ฒด ํธ์คํ ๋ฉ๋๋ค.
๋๋ฒ๊น ๊ฒฝํ์ ์ฆ๊ธฐ์ญ์์ค . OpenReplay๋ฅผ ๋ฌด๋ฃ๋ก ์ฌ์ฉํ์ญ์์ค .
REST API์์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๋ฐฉ๋ฒ๊ณผ Sveltekit์์ ๋ก๋ํ๋ ๊ฐ๋ ์ ๋ฐฐ์ฐ๊ธฐ ์ํด ์น์ฌ์ดํธ์ ๋ฐ๋ชจ ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ๋ง๋ค ๊ฒ์ ๋๋ค. ํ ์คํธ ๋ฐ ํ๋กํ ํ์ดํ์ ์ํ ๋ฌด๋ฃ ์จ๋ผ์ธ REST API ์ธ JSONPlaceholder ๋ผ๋ ๋ฌด๋ฃ ๊ฐ์ง REST API์ ์ํธ ์์ฉํ ๊ฒ์ ๋๋ค .
์์ํ๋ ค๋ฉด src/routes/blog.svelte ๋ฅผ ์ด๊ณ ๋ค์ ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ๊ฑฐ๋ ํจ๊ป ์ ๊ณต๋๋ ์์ค ์ฝ๋์ ํจ๊ป ์ฝ์ผ์ญ์์ค.
<!-- src/routes/blog.svelte -->
<svelte:head>
<title>Blog</title>
</svelte:head>
<script context="module">
export const load = async ({ fetch }) => {
const res = await fetch("https://jsonplaceholder.typicode.com/posts");
const blogposts = await res.json();
return {
props: {
blogposts,
}
}
}
</script>
<script>
export let blogposts;
</script>
<div class="container">
<h1>My Articles</h1>
<div class="blogposts">
{#each blogposts as post}
<div class="post">
<h2>{post.title.substring(0, 20)}</h2>
<p>{post.body.substring(0, 80)}</p>
<p class="readmore">
<a style=" color: rgb(10, 10, 139);" href={`/blog/${post.id}`}>
Read More
</a>
</p>
</div>
{/each}
</div>
</div>
์์ ์ฝ๋๋ฅผ ๋ถ์ํด๋ณด์. 6๋ฒ์งธ ์ค<script context="module">
์ ์ฃผ๋ชฉํ์ธ์ . ๊ตฌ์ฑ ์์๊ฐ ๋ ๋๋ง๋๊ธฐ ์ ์ ์คํ๋๊ธฐ ๋๋ฌธ์ ํ์ํฉ๋๋ค . ๊ตฌ์ฑ์์๋ณ ์ธ์คํด์ค ์ฝ๋๋ ๋ ๋ฒ์งธ ํ๊ทธ์ ์์ด์ผ ํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ํจ์๋ฅผ ์ฌ์ฉํ์ฌ jsonplaceholder ๊ฐ์ง API์์ ๋ฐ๋ชจ ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ๊ฐ์ ธ์ ์น์ฌ์ดํธ์ ํ์ํฉ๋๋ค.load<script>load
sveltekit ์ load
๊ธฐ๋ฅ์ ํด๋ผ์ด์ธํธ์ ์๋ฒ ๋ชจ๋์์ ์คํ๋๋ค๋ ์ ์ ์ ์ธํ๋ฉด Next.js ์ ๋น์ท getStaticProps
ํ๊ฑฐ๋ ๋น์ทํฉ๋๋ค.getServerSideProps
๋ํ ํ์ด์ง ์คํ์ผ ์ง์ ์ ์ํด ์ด ์์ต์์ ํจ๊ป ๋น๋ํ๋ ๊ฒฝ์ฐ ์ฝ๋ ๋ธ๋ก ๋ด์์ ํจ๊ป ์ ๊ณต๋๋ CSS ์ฝ๋๋ฅผ ๋ณต์ฌํ๋ ๊ฒ์ ์์ง ๋ง์ญ์์ค.
๊ทํ์ blog.svelte ๋ ๋ค์๊ณผ ๊ฐ์์ผ ํฉ๋๋ค.
์ด์ ๊ฐ์ ๋ธ๋ก๊ทธ๋ฅผ ๊ตฌ์ถํ๋ ค๋ฉด ๋์ ์ผ๋ก ์์ฑ๋ ๊ฒฝ๋ก๊ฐ ํ์ํฉ๋๋ค. Sveltekit์ ์ฌ์ฉํ๋ฉด ๋์ ๊ฒฝ๋ก๋ฅผ ํตํด ์ด๋ฅผ ์ฝ๊ฒ ๊ตฌํํ ์ ์์ต๋๋ค.
์ด๋ฅผ ๊ตฌํํ๋ ค๋ฉด blog ๋ผ๋ ์ ํด๋๋ฅผ ๋ง๋ญ๋๋ค . Sveltekit์ ๋์ ๋งค๊ฐ๋ณ์๋ [bracket]
. ์๋ฅผ ๋ค์ด ๋ธ๋ก๊ทธ ํด๋ ์์ [id].svelte ๋ผ๋ ํ์ผ์ ๋ง๋ญ๋๋ค . ํ์ผ์ ์ด๊ณ ๋ค์ ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ๊ฑฐ๋ ์์ค ์ฝ๋๋ฅผ ๋ฐ๋ฅด์ญ์์ค.
<script context="module">
export const load = async ({ page, fetch }) => {
const id = page.params.id;
const res = await fetch(`https://jsonplaceholder.typicode.com/posts/${id}`);
const post = await res.json();
return {
props: {
post,
}
}
}
</script>
์ฝ๋์์ load ํจ์ ๋ด์ ๋งค๊ฐ๋ณ์์ ์ก์ธ์คํ์ฌ ๋ณ์์ ํจ๊ป ์ ์ฅํ์ต๋๋ค id
. ๊ทธ๋ฐ ๋ค์ ๋งค๊ฐ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ํด๋น ID์ ์ ํํ ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ๊ฐ์ ธ์์ต๋๋ค. blog.svelte ๋ก ๋์๊ฐ์ ์๋ 33ํhref
์์ ๋์ ์ผ๋ก ์์ฑ๋ ํ์ด์ง์ ์ก์ธ์คํ ๋ฐฉ๋ฒ์ ๋ณผ ์ ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
<p class="readmore">
<a style="color: rgb(10, 10, 139);" href={`/blog/${post.id}`}>
Read More
</a>
</p>
๋ฅผ ์ฌ์ฉํ์ฌ ์ ํํ ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ์ก์ธ์คํ๋ ๋ฐฉ๋ฒ์ ํ์ธํ ์ ์์ต๋๋ค post.id
. ๋ฐ๋ผ์ ๋ ์ฝ๊ธฐ ๋ฅผ ํด๋ฆญ ํ๋ฉด ์ ์ฒด ๋ธ๋ก๊ทธ๋ฅผ ์ฝ์ ์ ์๋ ์ ํ์ด์ง๊ฐ ๋ก๋๋ฉ๋๋ค.
Sveltekit์์ ์ฑ์ ๋ฐฐํฌํ๋ ค๋ฉด ๋จผ์ ๊ฐ๋ฐ ๋์์ ๋ง๊ฒ ์กฐ์ ํด์ผ ํฉ๋๋ค. ์ด๋ํฐ๋ผ๊ณ ํ๋ ์ฌ๋ฌ ํ๋ฌ๊ทธ์ธ์ ์ ๊ณตํ์ฌ ๋ฐฐํฌ ํ๋ก์ธ์ค๋ฅผ ๋จ์ํํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค. ์ด๋ํฐ๋ ๋น๋๋ ์ฑ์ ์ ๋ ฅ์ผ๋ก ์ฌ์ฉํ๊ณ ๋ฐฐํฌ๋ฅผ ์ํ ์ถ๋ ฅ์ ์์ฑํ๋ ์์ ํ๋ฌ๊ทธ์ธ์ ๋๋ค.
Sveltekit์ ๊ณต์์ ์ผ๋ก ์ง์๋๋ ๋ช ๊ฐ์ง ์ด๋ํฐ๋ฅผ ์ ๊ณตํฉ๋๋ค.
์ ์ ์ด๋ํฐ : ์ฌ์ดํธ๋ฅผ Github ํ์ด์ง ๋ฑ๊ณผ ๊ฐ์ ํธ์คํ ์๋น์ค์ ํธํ๋๋ ์ ์ ํ์ผ ๋ชจ์์ผ๋ก ์ฌ์ ๋ ๋๋งํ๋ Sveltekit ์ฑ์ฉ ์ด๋ํฐ์ ๋๋ค.
์ด๋ํฐ Vercel : ๋์ ์๋ฒ ๋ ๋๋ง์ ์ํ ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ฌ Vercel ์ฑ์ ์์ฑํ๋ Svelte ์ฑ์ฉ ์ด๋ํฐ์ ๋๋ค. Vercel ํธ์คํ ํ๋ซํผ์ ์ฑ์ ๋ฐฐํฌํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
์ด๋ํฐ Netlify : ํ์ด์ง๋ฅผ ๋์ ์ผ๋ก ์์ฑํ๊ธฐ ์ํ ์๋น์ค ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ฌ Netlify ์ฑ์ ์์ฑํ๋ Svelte ์ฑ์ฉ ์ด๋ํฐ์ ๋๋ค. Netlify ํ๋ซํผ์ ์ฑ์ ๋ฐฐํฌํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
Netlify์ ๋ฐ๋ชจ ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
Netlify์ Sveltekit์ ๋ฐฐํฌํ๋ ค๋ฉด netlify-sveltekit ์ด๋ํฐ ๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค .
์๋ ๋ช ๋ น์ ์ฌ์ฉํ์ฌ ํ๋ก์ ํธ์ adpater๋ฅผ ์ค์นํ ์ ์์ต๋๋ค.
npm install -D @sveltejs/adapter-netlify@next
์ค์น๊ฐ ์๋ฃ๋๋ฉด ์ด๋ํฐ๋ฅผ ํ๋ก์ ํธ์ svelte.config.js ํ์ผ์ ์ถ๊ฐํฉ๋๋ค. ํ์ผ์ ์๋ ์ฝ๋๋ฅผ ์ฝ์ ํ์ญ์์ค.
import adapter from '@sveltejs/adapter-netlify';
export default {
kit: {
adapter: adapter(),
target: '#svelte'
}
};
๊ทธ๋ฐ ๋ค์ ํ๋ก์ ํธ์ ๊ธฐ๋ณธ ๋๋ ํฐ๋ฆฌ์ netlify.toml ํ์ผ์ ๋ง๋ค๊ณ ๋น๋ ๋ช ๋ น๊ณผ ๊ฒ์ ๋๋ ํฐ๋ฆฌ๋ฅผ ์ง์ ํฉ๋๋ค. ํ์ผ์ ์๋ ์ฝ๋๋ฅผ ์ฝ์ ํ์ญ์์ค.
[build]
command = "npm run build"
publish = "build"
์ด ๋ชจ๋ ์ค์ ์ด ๋๋๋ฉด Git ๋๋ Netlify CLI๋ฅผ ์ฌ์ฉํ์ฌ Netlify์ ํ๋ก์ ํธ๋ฅผ ๋ฐฐํฌํฉ๋๋ค .
Netlify ์ ์ต์ข ๋ฐฐํฌ๋ ์น ์ฌ์ดํธ์ ๋ํ ๋งํฌ( jolly-franklin-11e50c.netlify.app )์ ๋๋ค.
์ด ํํ ๋ฆฌ์ผ์ ํตํด ์ฆ๊ฒ๊ฒ ์์ ํ์ จ๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ์ํ ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ์ฌ Sveltekit์ ๊ธฐ๋ณธ ๊ฐ๋ ์ ์ดํด๋ณด๊ณ ๊ฐ์ฅ ์ค์ํ ๊ฒ์ ์ฑ ๋ด ๋ฐ๋ชจ ๋ธ๋ก๊ทธ์์ REST API๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ๊ณผ Netlify์ sveltekit ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด์์ต๋๋ค. ์์ ์ ์ํ ํฌํธํด๋ฆฌ์ค ์น์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ๋ ค๋ ๊ฒฝ์ฐ ๋ค๋ฅธ ํ์ด์ง๋ฅผ ๊ตฌ์ถํ์ฌ ๋ฐฐ์ด ๋ด์ฉ์ ์ค์ต์ ์ ์ฉํ๊ฑฐ๋ ์ด ๋ฐ๋ชจ๋ฅผ ์ทจํฅ์ ๋ง๊ฒ ์ ๊ทธ๋ ์ด๋ํ ์ ์์ต๋๋ค.
์ด ๊ธฐ์ฌ์ ๋ํ ์ง์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ Github์์ ์ฌ์ฉํ ์ ์์ต๋๋ค .
https://blog.openreplay.com ์ ์๋ณธ ๊ธฐ์ฌ ์ถ์ฒ
#sveltekit #svelte #webdev #webdev
1576633843
What is an API? Learn all about APIs (Application Programming Interfaces) in this full tutorial for beginners. You will learn what APIs do, why APIs exist, and the many benefits of APIs. APIs are used all the time in programming and web development so it is important to understand how to use them.
You will also get hands-on experience with a few popular web APIs. As long as you know the absolute basics of coding and the web, youโll have no problem following along.
โญ๏ธ Course Contents โญ๏ธ
โญ๏ธ Unit 1 - What is an API
โจ๏ธ Video 1 - Welcome (0:00:00)
โจ๏ธ Video 2 - Defining Interface (0:03:57)
โจ๏ธ Video 3 - Defining API (0:07:51)
โจ๏ธ Video 4 - Remote APIs (0:12:55)
โจ๏ธ Video 5 - How the web works (0:17:04)
โจ๏ธ Video 6 - RESTful API Constraint Scavenger Hunt (0:22:00)
โญ๏ธ Unit 2 - Exploring APIs
โจ๏ธ Video 1 - Exploring an API online (0:27:36)
โจ๏ธ Video 2 - Using an API from the command line (0:44:30)
โจ๏ธ Video 3 - Using Postman to explore APIs (0:53:56)
โจ๏ธ Video 4 - Please please Mr. Postman (1:03:33)
โจ๏ธ Video 5 - Using Helper Libraries (JavaScript) (1:14:41)
โจ๏ธ Video 6 - Using Helper Libraries (Python) (1:24:40)
โญ๏ธ Unit 3 - Using APIs
โจ๏ธ Video 1 - Introducing the project (1:34:18)
โจ๏ธ Video 2 - Flask app (1:36:07)
โจ๏ธ Video 3 - Dealing with API Limits (1:50:00)
โจ๏ธ Video 4 - JavaScript Single Page Application (1:54:27)
โจ๏ธ Video 5 - Moar JavaScript and Recap (2:07:53)
โจ๏ธ Video 6 - Review (2:18:03)
๐ Course Notes: https://github.com/craigsdennis/intro-to-apis-course/blob/master/course-notes.md
Shirts and Gifts for Your Friends & Loved โ https://bit.ly/36PHvXY
#api #webdev #python #javascript #web-development #webdev