๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โš’ Backend/Node.js

[Node.js] React Native + Node.js + MySQL To do list ๋งŒ๋“ค๊ธฐ 1 - ์„œ๋ฒ„ ์ดˆ๊ธฐ ์„ธํŒ…ํ•˜๊ธฐ (Initialize server setting)

by Fomagran ๐Ÿ’ป 2022. 7. 23.
728x90
๋ฐ˜์‘ํ˜•

 

์•ˆ๋…•ํ•˜์„ธ์š” Foma ์ž…๋‹ˆ๋‹ค.

 

์ด๋ฒˆ ๊ธ€์€ Node.js ์„œ๋ฒ„ ์ดˆ๊ธฐ ์„ธํŒ…ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ๋‹ค๋ค„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

๋ฐ”๋กœ ์‹œ์ž‘ํ• ๊ฒŒ์š”~


Tutorial

 


Install

 

Node.js ์„œ๋ฒ„๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด Node.js๋ฅผ ์„ค์น˜ํ•ด ์ค๋‹ˆ๋‹ค.

 

Node.js

 

 

๋‹ค์šด๋กœ๋“œ | Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

 

VSCode๋กœ ์„œ๋ฒ„ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ์ง„ํ–‰ํ•  ๊ฒƒ์ด๋ฏ€๋กœ VSCode๋ฅผ ์„ค์น˜ํ•ด ์ค๋‹ˆ๋‹ค.( ๋‹ค๋ฅธ IDE๋ฅผ ์‚ฌ์šฉํ•˜์…”๋„ ์ƒ๊ด€ ์—†์Šต๋‹ˆ๋‹ค.)

 

Visual Studio Code

 

 

Visual Studio Code - Code Editing. Redefined

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications.  Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.

code.visualstudio.com


Setting

 

์›ํ•˜๋Š” ์œ„์น˜์— ํด๋”๋ฅผ ์ƒ์„ฑํ•ด ์ค๋‹ˆ๋‹ค.

 

VSCode์—์„œ ์œ„์—์„œ ๋งŒ๋“  ํด๋”๋กœ ์ด๋™ํ•ด ์ค๋‹ˆ๋‹ค

 

 

ํ„ฐ๋ฏธ๋„์„ ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ค๋‹ˆ๋‹ค.

 

 

npm์„ ์ดˆ๊ธฐํ™” ํ•ด์ค๋‹ˆ๋‹ค.

 

npm init

 

๊ทธ๋Ÿฌ๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ๋ช‡ ๊ฐ€์ง€ ์งˆ๋ฌธ์„ ํ•  ๊ฑฐ์—์š”.

 

์›ํ•˜๋Š” ๋‚ด์šฉ์„ ์ž…๋ ฅํ•ด๋„ ๋˜์ง€๋งŒ ์ด๋ฒˆ์—๋Š” ๊ทธ๋ƒฅ ๋ชจ๋‘ ์—”ํ„ฐ๋งŒ ์ณ์„œ package๋ฅผ ๋งŒ๋“ค๊ฒ ์Šต๋‹ˆ๋‹ค.

 

package.json์ด ์ƒ์„ฑ ๋ฉ๋‹ˆ๋‹ค.

 

์‰ฝ๊ฒŒ ์„œ๋ฒ„๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ๋„์™€์ฃผ๋Š” express ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์„ค์น˜ํ•ด ์ค๋‹ˆ๋‹ค.

 

npm install --save express

 

node_modules์™€ package-lock.json์ด ์ƒ๊น๋‹ˆ๋‹ค.

 


Test

 

์ด์ œ ์ •์ƒ์ ์œผ๋กœ ์„œ๋ฒ„๊ฐ€ ์ž‘๋™ํ•˜๋Š”์ง€ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

index.js ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ์ค๋‹ˆ๋‹ค.

 

 

index.js

 

const express = require("express");
const app = express();

app.get("/", function (req, res) {
  res.send("์•ˆ๋…•ํ•˜์„ธ์š”!");
});
app.listen(3000, () => console.log("3000ํฌํŠธ์—์„œ ๋Œ€๊ธฐ ์ค‘..."));

 

์•„๋ž˜์™€ ๊ฐ™์ด ๋Œ€๊ธฐ ์ค‘์ด๋ผ๋Š” ๋กœ๊ทธ๊ฐ€ ์ฐํžˆ๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

์ฃผ์†Œ์ฐฝ์— localhost:ํฌํŠธ๋ฒˆํ˜ธ๋กœ ์ด๋™ํ•˜๊ฒŒ ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด "์•ˆ๋…•ํ•˜์„ธ์š”!" ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ๋œจ๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 


Next Tutorial

 

 

[MySQL] React Native + Node.js + MySQL To do list ๋งŒ๋“ค๊ธฐ 2 - MySQL ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ (Create a MySQL Table)

Install MySQL MySQL :: Download MySQL Installer Select Operating System: Select Operating System… Microsoft Windows Select OS Version: All Windows (x86, 32-bit) Windows (x86, 32-bit), MSI Installe..

fomaios.tistory.com


Source code

 

์•„๋ž˜ ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜๋ฉด ์ „์ฒด ์†Œ์Šค๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

๊ถ๊ธˆํ•˜์‹  ์  ์žˆ์œผ์‹œ๋ฉด ์–ธ์ œ๋“  ๋Œ“๊ธ€ ๋‹ฌ์•„์ฃผ์„ธ์š”!

 

 

GitHub - fomagran/ToDoListFullStack: React native(CLI,TS) + Node.js + MySQL

React native(CLI,TS) + Node.js + MySQL. Contribute to fomagran/ToDoListFullStack development by creating an account on GitHub.

github.com

728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€