본문 바로가기

getting_started61

[FastAPI] Getting Started 최근 가벼운 서버를 구축할 필요가 생겨 사용하는 김에 정리를 해봅니다. 배우기 쉽고 빠른 성능을 보인다고 하니 가볍게 사용할 수 있고, Python 기반이라 금방 익힐 수 있는 것 같아요. Install Module 먼저, 필요한 모듈들을 설치해 줍니다. $ pip install fastapi "uvicorn[standard]" Implement Server 다음으로, server application을 구현합니다. # main.py from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} Root("/") 경로로 요청이 오면 "Hello World"를 반환해 줍니다.. 2023. 9. 13.
[Next.js] Getting Started with VSCode 이번에는 Next.js의 개발 환경 설정을 알아보겠습니다. Create Project npx를 사용하여 최신 버전으로 프로젝트를 생성하겠습니다. $ npx create-next-app@latest --ts example Typescript를 사용하기 위하여 --ts옵션을 주었고, 저는 프로젝트 이름을 example로 했는데 이부분에 원하는 이름을 적어 주면 됩니다. 현재 (23/09/08) 기준으로 최신 버전은 v13.4.19 네요. 몇 가지 옵션을 설정해주시면 프로젝트가 생성됩니다. 참고하셔서 원하는 옵션을 선택하시면 되요. Install Extension for VSCode 먼저 linting 도구인 ESLint를 설치해 줍니다. 기본적으로 설정은 프로젝트 생성 시 되어 있으므로 변경이 필요하시면 수.. 2023. 9. 8.
[Go] Package A package is a bundle of structures, constants, variables, functions, etc. with the same purpose. Using Package If you want to use packages, use import keyword. import "fmt" You can alias to package. import htemplate "html/template" You can import packages even not used. import _ "math" In this case, you don't use the package, but you can get the effects of initializing the package. Go Module Th.. 2021. 10. 16.
[Go] Structure Structure consists of different types of values. The syntax is following: type STRUCT_NAME struct { FIELD_NAME DATA_TYPE ... } If the name of a structure starts with a capital letter, it is exported to the outside of the package. Structure Declaration var testStruct struct { numField float64 strField string boolField bool } fmt.Println(testStruct) // {0 false}] testStruct.numField = 7 testStruct.. 2021. 10. 11.
[Go] Array An array is a collection of values all of which have the same type. The value that an array has is called an element. The syntax of array definition is following: var VARIABLE_NAME [NUMBER_OF_ELEMENTS]DATA_TYPE var numArr [3]int numArr[0] = 1 numArr[1] = 2 numArr[2] = 3 fmt.Println(numArr[0], numArr[1], numArr[2]) // 1 2 3 An array is static. Therefore, it is not possible to add a new element af.. 2021. 10. 10.
[Go] Operator Operator Precedence Unary operators have the highest precedence. As the ++ and -- operators form statements, not expressions, they fall outside the operator hierarchy. Go supports only post-increment and post-decrement operators, not pre-increment and pre-decrement. There are five precedence levels for binary operators. Binary operators of the same precedence associate from left to right. Preced.. 2021. 10. 4.
[VS Code] Extensions 추천 - (2021.09.17) 제가 현재 사용하는 것들 소개 및 추천 드려보고자 합니다. 저도 필요에 따라 골라 쓰고 있으니 맘에 드는 것들 골라 쓰시면 되요. ^^ Extensions 메뉴를 열려면 단축키(⇧⌘X)를 사용하시거나 좌측 메뉴에서 아이콘을 클릭하시면 되요. Appearance Material Theme 더보기 요 확장은 칼라 테마를 변경할 수 있게 해줍니다. ⌘K⌘T 키를 눌러 원하는 테마를 선택할 수 있습니다. 기분따라 쓸 때도 있고, 기본을 쓸 때도 있어요. 예전에 Vim이나 eclipse를 썼을 때는 좋아하는 테마가 있어서 그런 것들 사용하거나 직접 만들어 썼었는데... 지금은 그냥 기본이나 요 테마 를 번갈아가며 써요. Material Icon Theme 더보기 요 확장은 아이콘 테마를 변경할 수 있게 해줍니다... 2021. 9. 17.
[Svelte] Using TailwindCSS on Svelte TailwindCSS is my favorite CSS framework. Let's use TailwindCSS on Svelte. Create an Application Create a svelte application via a template. Please see Create an Application section on the below post. 2021.09.14 - [Web/Etc] - [Svelte] Getting Started with VSCode Add TailwindCSS Add dependencies for TailwindCSS. $ yarn add -D tailwindcss postcss autoprefixer or $ npm install -D tailwindcss postcs.. 2021. 9. 14.
[Svelte] Getting Started with VSCode Svelte is a framework that aims to "write less code", "no virtual dom", and "truly reactive". Therefore, the application code and result of svelte are simple and tiny. Create an Application Let's create a svelte application using the template. $ npx degit sveltejs/template getting-started Move to the application folder. $ cd getting-started Enable TypeScript. $ node scripts/setupTypeScript.js In.. 2021. 9. 14.
[Python] Running Python with Docker In this posting, we will be looking into running python with docker. Install Docker I will use docker on MAC with homebrew. $ brew install --cask docker Please refer to the official site for installing docker if you want to use it another way or use another OS. https://docs.docker.com/get-docker/ Get Docker docs.docker.com Now, run the docker. Then docker is automatically downloaded and you can .. 2021. 8. 28.
[PyQt6] Getting Started In this posting, we will learn how to create the desktop application using PyQt6. Installation $ pip install pyqt6 Now, we prepared for using PyQt6. Create Application Using Function import sys from PyQt6.QtWidgets import QApplication, QWidget def main(): w = QWidget() w.resize(320, 240) w.setWindowTitle('PyQt6 Example') w.show() sys.exit(app.exec()) if __name__ == '__main__': app = QApplication.. 2021. 8. 10.
[TypeScript] Class The class of TypeScript is similar to other languages. class Person { name: string; constructor(name: string) { this.name = name; } introduce() { console.log(`My name is ${this.name}`); } } let person = new Person('hoya'); person.introduce(); // My name is hoya Structural Type System TypeScript uses structural type system. That is, if the class has the same structure, they are compatible with ea.. 2021. 7. 4.