<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by readbetweenthelines on Medium]]></title>
        <description><![CDATA[Stories by readbetweenthelines on Medium]]></description>
        <link>https://medium.com/@feedbotstar?source=rss-efee28f020fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*c78uGkSRSy_ggCPI.jpg</url>
            <title>Stories by readbetweenthelines on Medium</title>
            <link>https://medium.com/@feedbotstar?source=rss-efee28f020fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 21:00:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@feedbotstar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Nest.js + GraphQL 시작하기]]></title>
            <link>https://medium.com/@feedbotstar/nest-js-graphql-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0-f38adf767fa8?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f38adf767fa8</guid>
            <category><![CDATA[nest]]></category>
            <category><![CDATA[typeorm]]></category>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Sat, 02 May 2020 17:40:28 GMT</pubDate>
            <atom:updated>2020-05-02T17:40:28.664Z</atom:updated>
            <content:encoded><![CDATA[<p>30분만 해보기</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zpo0nZOBXcP4gGBTZxiOg.png" /></figure><p>Nest 프로젝트에 GraphQL 을 설정하는 방법을 살펴봅니다. PostgreSQL 과 TypeORM 을 적용한 기반 프로젝트에서 시작했습니다.</p><h4>프로젝트 생성</h4><p><a href="https://medium.com/@feedbotstar/nest-js-typeorm-postgresql-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0-153c3a55aba1">Nest.js + TypeORM + PostgreSQL 프로젝트 생성</a></p><h4>라이브러리 설치</h4><p>graphql 지원 도구를 설치합니다.</p><pre>$ npm install @nestjs/graphql apollo-server-express graphql-tools type-graphql graphql</pre><h4>앱 모듈에 GraphQL 설정</h4><pre>// /server/app.module.ts<br>...<br>@Module({<br>    imports: [<br>        GraphQLModule.forRoot({<br>            autoSchemaFile: &#39;schema.gpl&#39;<br>        }),<br>		  ...</pre><p>코드 기반으로 GraphQL 스키마를 생성합니다. 스키마 파일은 schema.gql 에 자동생성됩니다.</p><h4>스키마 설계</h4><p>다음의 두 가지 요청을 구현하려고 합니다.</p><pre>// 상품 조회<br>query {<br>    getProducts {<br>        id, title, price<br>    }<br>}<br>// 상품 생성<br>mutation {<br>  createProduct(<br>    data: { title: &quot;벨벳&quot;, price: 890000 }<br>  ) {<br>    id, title, price<br>  }<br>}</pre><h4>모델 생성</h4><p>도메인을 하나 생성합니다.</p><pre>$ nest generate module product<br>$ nest generate service product<br>$ nest generate resovle product</pre><p>Product 엔터티를 생성합니다.</p><pre>// /server/product/product.entity.ts<br>import { Entity, BaseEntity, PrimaryGeneratedColumn, Column } from &quot;typeorm&quot;;</pre><pre>@Entity()<br>export class Product extends BaseEntity {</pre><pre>    @PrimaryGeneratedColumn()<br>    id!: number;</pre><pre>    @Column(&#39;varchar&#39;, { length: 30 })<br>    title!: string;<br>    <br>    @Column()<br>    price!: number;<br>}</pre><p>Product 모듈에 Product 엔터티 참조를 설정합니다.</p><pre>// /server/product/product.module.ts<br>...<br>@Module({<br>  imports: [TypeOrmModule.forFeature([Product])],<br>  providers: [ProductService, ProductResolver],<br>...</pre><p>App 모듈에 ORM 엔터티 연결 설정을 합니다.</p><pre>// /server/app.module.ts<br>...<br>@Module({<br>    imports: [<br>		  ...<br>        TypeOrmModule.forRoot({<br>			  ...<br>            &quot;entities&quot;: [Product, .....],<br>        }),<br>...</pre><p>Product 테이블을 생성합니다.</p><pre>$ npm run make:migrations CreateProduct<br>$ npm run make:migrate</pre><h4>타입 생성</h4><p>GraphQL 출력 타입으로 사용할 데이터 오브젝트를 하나 생성합니다.</p><pre>// /server/product/product.dto.ts<br>import { ObjectType, Field, Int } from &quot;@nestjs/graphql&quot;;</pre><pre>@ObjectType()<br>export class ProductDto {<br>    @Field()<br>    readonly id?: number;</pre><pre>    @Field()<br>    readonly title!: string;</pre><pre>    @Field(() =&gt; Int)<br>    readonly price!: number;<br>}</pre><p>GraphQL 입력 타입으로 사용할 입력 오브젝트를 하나 생성합니다.</p><pre>// /server/product/product.input.ts<br>import { InputType, Field, Int } from &quot;@nestjs/graphql&quot;;</pre><pre>@InputType()<br>export class InputProduct {<br>    @Field()<br>    readonly title!: string;</pre><pre>    @Field(() =&gt; Int)<br>    readonly price!: number;<br>}</pre><h4>서비스 생성</h4><p>기본 메소드를 이용하여 데이터 생성과 조회 기능을 작성합니다.</p><pre>...<br>import { Product } from &#39;./product.entity&#39;;<br>import { ProductDto } from &#39;./product.dto&#39;;</pre><pre>@Injectable()<br>export class ProductService {<br>    constructor(<br>        @InjectRepository(Product) private readonly productRepository: Repository&lt;Product&gt;<br>    ) { }</pre><pre>    async createProduct(data: ProductDto) {<br>        return await this.productRepository.create(data).save();<br>    }</pre><pre>    async getProducts() {<br>        return await this.productRepository.find();<br>    }<br>}</pre><h4>리졸버 생성</h4><p>스키마에 따라 Query 와 Mutation 을 매핑하는 메소드를 작성합니다.</p><pre>// /server/product/product.resolver.ts<br>import { Query, Resolver, Mutation, Args } from &#39;@nestjs/graphql&#39;;<br>import { ProductService } from &#39;./product.service&#39;;<br>import { ProductDto } from &#39;./product.dto&#39;;<br>import { InputProduct } from &#39;./product.input&#39;;</pre><pre>@Resolver(&#39;Product&#39;)<br>export class ProductResolver {</pre><pre>    constructor( <br>        private readonly productService: ProductService,<br>    ) { }</pre><pre>    @Query(() =&gt; [ ProductDto ]) <br>    async getProducts() {<br>        return await this.productService.getProducts();<br>    }</pre><pre>    @Mutation(() =&gt; ProductDto ) <br>    async createProduct(@Args(&#39;data&#39;) data: InputProduct) {<br>        return await this.productService.createProduct(data);<br>    }<br>}</pre><p>이제 서버 구동 후 <a href="http://localhost:3000/graphql">http://localhost:3000/graphql</a> 에 접속하여 질의 결과를 확인할 수 있습니다. 스키마 파일은 schema.gql 에 생성됩니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yszFEwN0G9Xe2Zzie5DY_Q.png" /></figure><p>이제 꿀잠 자러 가야겠습니다.</p><h3>참고</h3><ul><li><a href="https://docs.nestjs.com/graphql/quick-start">Documentation | NestJS — A progressive Node.js framework</a></li><li><a href="https://rohanfaiyaz.com/post/nest-graphql/#&amp;gid=1&amp;pid=2">NestJS GraphQL API with TypeORM and Postgres — Rohan Faiyaz Khan</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f38adf767fa8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nest.js + TypeORM + PostgreSQL 시작하기]]></title>
            <link>https://medium.com/@feedbotstar/nest-js-typeorm-postgresql-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0-153c3a55aba1?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/153c3a55aba1</guid>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[posgresql]]></category>
            <category><![CDATA[typeorm]]></category>
            <category><![CDATA[nest]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Fri, 01 May 2020 10:21:15 GMT</pubDate>
            <atom:updated>2020-05-01T10:21:15.562Z</atom:updated>
            <content:encoded><![CDATA[<p>삽질 해보기</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*rN7ABnO4egY1LjNyrcxikA.png" /></figure><p>Nest 프로젝트에 TypeORM 을 설정하는 방법을 살펴봅니다. PostgreSQL 는 Heroku에 생성하고 Nest + Next 프로젝트 템플릿을 기반으로 시작했습니다.</p><h4>프로젝트 생성</h4><p><a href="https://medium.com/@feedbotstar/nest-js-next-js-%ED%95%A8%EA%BB%98-%EC%93%B0%EA%B8%B0-d515ab6eea87">Nest.js + Next.js 프로젝트 생성</a> 소스 디렉토리를 설정합니다.</p><pre>// 변경 대상 : /src  -&gt; /server<br>package.json<br>nest-cli.json<br>tsconfig.server.json</pre><h4>라이브러리 설치</h4><pre>// ORM 과 DB 드라이버<br>$ npm install @nestjs/typeorm typeorm pg <br>$ npm install ts-node -g</pre><h4>DB 연결 설정</h4><p>DB 접속 환경에 따른 TypeORM 설정을 작성합니다.</p><pre>// ormconfig.json<br>{<br>    &quot;type&quot;: &quot;postgres&quot;,<br>    &quot;host&quot;: _DB_HOST_,<br>    &quot;port&quot;: _DB_PORT_,<br>    &quot;username&quot;: _DB_USER_,<br>    &quot;password&quot;: _DB_PASSWORD_,<br>    &quot;database&quot;: _DB_NAME_,<br>    &quot;extra&quot;: {<br>        &quot;ssl&quot;: {<br>            &quot;rejectUnauthorized&quot;: false<br>        }<br>    },<br>    &quot;synchronize&quot;: true,<br>    &quot;logging&quot;: false,<br>    &quot;entities&quot;: [<br>        &quot;server/**/*.entity.ts&quot;<br>    ],<br>    &quot;migrations&quot;: [<br>        &quot;server/migration/**/*.ts&quot;<br>    ],<br>    &quot;subscribers&quot;: [<br>        &quot;server/subscriber/**/*.ts&quot;<br>    ],<br>    &quot;cli&quot;: {<br>        &quot;migrationsDir&quot;: &quot;server/migration&quot;,<br>        &quot;subscribersDir&quot;: &quot;server/subscriber&quot;<br>    }<br>}</pre><p>TypeORM CLI 에서 사용합니다.</p><p>마이그레이션 스크립트를 추가합니다.</p><pre>// package.json<br>...<br>    &quot;make:migrations&quot;: &quot;ts-node -P tsconfig.server.json ./node_modules/typeorm/cli.js migration:generate -n&quot;,<br>    &quot;make:migrate&quot;: &quot;ts-node -P tsconfig.server.json ./node_modules/typeorm/cli.js migration:run&quot;,<br>    &quot;make:rollback&quot;: &quot;ts-node -P tsconfig.server.json ./node_modules/typeorm/cli.js migration:revert&quot;,<br>...</pre><p>App 모듈에 TypeORM 모듈을 연결합니다.</p><pre>// server/app.module.ts<br>import { TypeOrmModule } from &#39;@nestjs/typeorm&#39;;<br>...<br>@Module({<br>  imports: [<br>        TypeOrmModule.forRoot({<br>            &quot;type&quot;: &quot;postgres&quot;,<br>            &quot;host&quot;: __DB_HOST__,<br>            &quot;port&quot;: __DB_PORT__,<br>            &quot;username&quot;: __DB_USER__,<br>            &quot;password&quot;: __DB_PASSWORD__,<br>            &quot;database&quot;: __DB_NAME__,<br>            &quot;extra&quot;: {<br>                &quot;ssl&quot;: {<br>                    &quot;rejectUnauthorized&quot;: false<br>                }<br>            },<br>            &quot;entities&quot;: [],<br>        }),<br>	...</pre><p>Nest 서버 구동시 참조됩니다.</p><h4>모델 생성</h4><p>먼저 도메인을 하나 생성합니다.</p><pre>$ nest generate module user<br>$ nest generate service user<br>$ nest generate controller user</pre><p>위에 생성된 디렉토리에 User 엔터티를 작성합니다. (관계 생성 없음)</p><pre>// server/user/user.entity.ts<br>import {Entity, PrimaryGeneratedColumn, Column} from &quot;typeorm&quot;;</pre><pre>@Entity()<br>export class User extends BaseEntity {<br>    @PrimaryGeneratedColumn()<br>    id!: number;<br>    @Column({ nullable: false })<br>    firstName!: string;<br>    @Column({ nullable: false })<br>    lastName!: string;<br>    @Column()<br>    age?: number;<br>}</pre><p>마이그레이션을 수행하여 User 테이블을 생성합니다.</p><pre>$ npm run make:migrations CreateUser<br>$ npm run make:migrate</pre><p>DataGrip 나 pgAdmin 으로 생성된 테이블을 확인합니다.</p><p>User 모듈에서 서비스와 컨트롤러에서 사용할 수 있도록 User 모델을 연결합니다.</p><pre>// server/user/user.module.ts<br>@Module({<br>	...<br>  imports: [TypeOrmModule.forFeature([User])]<br>})</pre><p>App 모듈에 TypeORM 엔터티에도 추가합니다.</p><pre>...<br>@Module({<br>  imports: [<br>        TypeOrmModule.forRoot({<br>				...<br>            	&quot;entities&quot;: [User],<br>        }),<br>...</pre><h4>리파지토리 생성</h4><pre>// server/user/user.repository.ts<br>import { EntityRepository, Repository } from &quot;typeorm&quot;;<br>import { User } from &quot;./user.entity&quot;;</pre><pre>@EntityRepository(User)<br>export class UserRepository extends Repository&lt;User&gt; {<br>}</pre><p>User 엔터티에 접근할 수 있는 기본적인 인터페이스를 작성합니다.</p><p>데이터 객체도 하나 작성합니다.</p><pre>// server/user/user.dto.ts<br>export class UserDto {<br>    firstName!: string;<br>    lastName!: string;<br>    age?: number;<br>}</pre><h4>서비스 생성</h4><p>UserRepository 기본 메소드를 이용하여 간단한 CRUD 로직을 작성합니다.</p><pre>...<br>import { UserRepository } from &quot;./user.repository&quot;;</pre><pre>@Injectable()<br>export class UserService {<br>    constructor(<br>        @InjectRepository(User) private readonly userRepository: UserRepository<br>    ) { }</pre><pre>    createOneUser(createUserDto: UserDto) {<br>        return this.userRepository.create(createUserDto).save();<br>    }</pre><pre>    getUserList() {<br>        return this.userRepository.find({<br>            select: [&quot;id&quot;, &quot;firstName&quot;, &quot;lastName&quot;, &quot;age&quot;],<br>        });<br>    }</pre><pre>    getDetailUser(id: number) {<br>        return this.userRepository.findOne(id);<br>    }</pre><pre>    updateUser(id: number, updateUserDto: UserDto) {<br>        return this.userRepository.update(id, updateUserDto);<br>    }</pre><pre>    removeOneUser(id: number) {<br>        return this.userRepository.delete(id);<br>    }<br>}</pre><h4>컨트롤러 생성</h4><p>API 로 노출할 컨트톨러를 작성합니다.</p><pre>...<br>import { UserService } from &quot;./user.service&quot;;<br>import { UserDto } from &quot;./user.dto&quot;;</pre><pre>@Controller(&quot;users&quot;)<br>export class UserController {<br>    constructor(private readonly userService: UserService) { }</pre><pre>    @Post()<br>    async create(@Body() createUserDto: UserDto) {<br>        const result = await this.userService.createOneUser(createUserDto);<br>        return result;<br>    }</pre><pre>    @Get()<br>    async getList() {<br>        const result = await this.userService.getUserList();<br>        return result;<br>    }</pre><pre>    @Get(&quot;:id&quot;)<br>    async getOne(@Param(&quot;id&quot;) userId: number) {<br>        const result = await this.userService.getDetailUser(userId);<br>        return result;<br>    }</pre><pre>    @Put(&quot;:id&quot;)<br>    async setOne(@Param(&quot;id&quot;) userId: number, @Body() updateUserDto: UserDto) {<br>        const result = await this.userService.updateUser(userId, updateUserDto);<br>        return result;<br>    }</pre><pre>    @Delete(&quot;:id&quot;)<br>    async removeOne(@Param(&quot;id&quot;) userId: number) {<br>        const ret = await this.userService.removeOneUser(userId);<br>        return ret;<br>    }<br>}</pre><p>API 클라이언트로 확인해봅니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iL7-jLNNe1dYfZeGr4Gx3Q.png" /></figure><p>이제 산책하러 가야겠습니다.</p><h4>참고</h4><ul><li><a href="https://docs.nestjs.com/recipes/sql-typeorm">Documentation | NestJS — A progressive Node.js framework Typeorm</a></li><li><a href="https://medium.com/@gausmann.simon/nestjs-typeorm-and-postgresql-full-example-development-and-project-setup-working-with-database-c1a2b1b11b8f">NestJS, TypeORM and PostgreSQL — full example development and project setup working with database migrations.</a></li><li><a href="https://docs.nestjs.com/techniques/database">Documentation | NestJS — A progressive Node.js framework Database</a></li><li><a href="https://github.com/typeorm/typeorm/blob/master/docs/using-cli.md">typeorm/using-cli.md at master · typeorm/typeorm · GitHub</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=153c3a55aba1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nest.js + Next.js 함께 쓰기]]></title>
            <link>https://medium.com/@feedbotstar/nest-js-next-js-%ED%95%A8%EA%BB%98-%EC%93%B0%EA%B8%B0-d515ab6eea87?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d515ab6eea87</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[nest]]></category>
            <category><![CDATA[next]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 16:27:50 GMT</pubDate>
            <atom:updated>2020-04-28T16:27:50.727Z</atom:updated>
            <content:encoded><![CDATA[<p>30분만 해보기</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHj-Sv4u0c_fg_LSA6coWg.png" /></figure><p>Nest 프로젝트에서는 Angular Universal SSR 을 사용할 수 있지만 React SSR 라이브러리인 Next.js 를 통합할 수 있도록 도와주는 nest-next 라이브러리가 있습니다. 이를 통해 Next와 Next 를 통합하는 설정 방법을 살펴봅니다.</p><h4>프로젝트 생성</h4><pre>$ nest new with-nest-next-ssr &amp;&amp; cd with-nest-next-ssr<br>$ code .</pre><h4>Next 와 nest-next 라이브러리 설치</h4><pre>$ npm install next react react-dom @types/react @types/react-dom nest-next </pre><pre>// next page 디렉토리 생성<br>$ mkdir -p public pages pages/views</pre><p>nest-next 라이브러리는 페이지뷰 렌더링시 Next 에 넘겨주는 역할을 합니다.</p><h4>실행 스크립트 수정</h4><pre>// package.json<br>...<br>    &quot;build&quot;: &quot;nest build -p tsconfig.server.json&quot;,<br>    &quot;start&quot;: &quot;nest start -p tsconfig.server.json&quot;,<br>    &quot;start:dev&quot;: &quot;nest start -p tsconfig.server.json --watch&quot;,<br>    &quot;start:debug&quot;: &quot;nest start -p tsconfig.server.json --debug --watch&quot;,<br>...</pre><h4>타입스크립트 컴파일 설정 수정</h4><pre>$ rm -f tsconfig.build.json<br>// tsconfig.json<br>{<br>    &quot;compilerOptions&quot;: {<br>        &quot;experimentalDecorators&quot;: true,<br>        &quot;target&quot;: &quot;esnext&quot;,<br>        &quot;module&quot;: &quot;esnext&quot;,<br>        &quot;lib&quot;: [<br>            &quot;dom&quot;,<br>            &quot;dom.iterable&quot;,<br>            &quot;esnext&quot;,<br>        ],<br>        &quot;allowJs&quot;: true,<br>        &quot;skipLibCheck&quot;: true,<br>        &quot;strict&quot;: true,<br>        &quot;forceConsistentCasingInFileNames&quot;: true,<br>        &quot;noEmit&quot;: true,<br>        &quot;esModuleInterop&quot;: true,<br>        &quot;moduleResolution&quot;: &quot;node&quot;,<br>        &quot;resolveJsonModule&quot;: true,<br>        &quot;isolatedModules&quot;: true,<br>        &quot;jsx&quot;: &quot;preserve&quot;,<br>        &quot;allowSyntheticDefaultImports&quot;: true,<br>        &quot;noUnusedLocals&quot;: true,<br>        &quot;noUnusedParameters&quot;: true,<br>        &quot;removeComments&quot;: false,<br>        &quot;preserveConstEnums&quot;: true,<br>        &quot;sourceMap&quot;: true,<br>    },<br>    &quot;exclude&quot;: [<br>        &quot;node_modules&quot;,<br>        &quot;dist&quot;<br>    ],<br>    &quot;include&quot;: [<br>        &quot;next-env.d.ts&quot;,<br>        &quot;**/*.ts&quot;,<br>        &quot;**/*.tsx&quot;<br>    ]<br>}</pre><pre>// tsconfig.server.json<br>{<br>  &quot;extends&quot;: &quot;./tsconfig.json&quot;,<br>  &quot;compilerOptions&quot;: {<br>    &quot;module&quot;: &quot;commonjs&quot;,<br>    &quot;declaration&quot;: true,<br>    &quot;removeComments&quot;: true,<br>    &quot;emitDecoratorMetadata&quot;: true,<br>    &quot;experimentalDecorators&quot;: true,<br>    &quot;target&quot;: &quot;es2017&quot;,<br>    &quot;sourceMap&quot;: true,<br>    &quot;outDir&quot;: &quot;./dist&quot;,<br>    &quot;baseUrl&quot;: &quot;./&quot;,<br>  },<br>  &quot;exclude&quot;: [&quot;node_modules&quot;, &quot;test&quot;, &quot;dist&quot;, &quot;**/*spec.ts&quot;],<br>  &quot;include&quot;: [&quot;src&quot;]<br>}</pre><h4>앱 모듈에서 렌더링 설정</h4><pre>// src/app.module.ts<br>...<br>import Next from &#39;next&#39;;<br>import { RenderModule } from &#39;nest-next&#39;;</pre><pre>@Module({<br>  imports: [<br>    RenderModule.forRootAsync(Next({ dev: process.env.NODE_ENV !== &#39;production&#39; })),    <br>  ],<br>  controllers: [AppController],<br>  providers: [AppService],<br>})<br>...</pre><p>앱 모듈 실행시 Next 가 실행되도록 설정합니다. (.next 디렉토리에 생성)</p><h4>컨트롤러 작성</h4><pre>// src/app.controller.ts<br>...<br>import { Controller, Get, Render } from &#39;@nestjs/common&#39;;</pre><pre>@Controller()<br>export class AppController {<br>  constructor(private readonly appService: AppService) {}</pre><pre>  @Get()<br>  @Render(&#39;Index&#39;)<br>  public index() {<br>    // Index.InitialProps 에 전달.<br>    return {<br>      title: &#39;Nest with Next&#39;,<br>    };<br>  } <br>...</pre><p>응답할 렌더링 페이지를 설정하고 InitialProps 에 응답 데이터를 전달합니다.</p><h4>페이지뷰 작성</h4><pre>// pages/views/Index.tsx<br>import React from &#39;react&#39;;<br>import { NextPageContext } from &#39;next&#39;;<br>import Head from &#39;next/head&#39;;</pre><pre>type IndexProps = {<br>    query : {<br>        title: string<br>    }<br>}</pre><pre>export default function Index(props: IndexProps) {<br>    const { title } = props.query;<br>    return (<br>        &lt;&gt;<br>            &lt;Head&gt;&lt;title&gt;{title}&lt;/title&gt;&lt;/Head&gt;<br>            &lt;div&gt;<br>                타이틀은 {title} 입니다.<br>            &lt;/div&gt;<br>        &lt;/&gt;<br>    )<br>}</pre><pre>Index.getInitialProps = async function (context: NextPageContext) {<br>    const { query } = context;<br>    return { query }<br>}</pre><p>브라우져에서 타이틀 값을 확인해 봅니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*oAL0eZlmmjfhqVgioRL_mQ.png" /></figure><p>꿀 잠자러 가야겠습니다.</p><h3>참고</h3><p><a href="https://github.com/kyle-mccarthy/nest-next">GitHub — kyle-mccarthy/nest-next: Render Module to add Nextjs support for Nestjs</a> <br><a href="https://medium.com/real-dev-engineering/next-nest-working-together-199bd45c1bcc">Next + Nest: Working together — Real Dev Engineering — Medium</a> <a href="https://angular.io/guide/universal">Angular</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d515ab6eea87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Heroku 에 Nest.js 프로젝트 배포]]></title>
            <link>https://medium.com/@feedbotstar/heroku-%EC%97%90-nest-js-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EB%B0%B0%ED%8F%AC-e4d9f6199281?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4d9f6199281</guid>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[nest]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Sat, 25 Apr 2020 13:29:34 GMT</pubDate>
            <atom:updated>2020-04-25T13:29:34.850Z</atom:updated>
            <content:encoded><![CDATA[<p>10분만 해보기</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNbShBO-49j8j7WMXFrdJA.png" /></figure><p>간단한 Nest 프로젝트를 생성한 후 신용카드 없이 Node 서버를 돌려볼 수 있는 Heroku 에 배포하려고 합니다.</p><p>환경 준비 <br>* Nest CLI 설치 <br>* Horoku App 생성 <br>* Heroku CLI 및 로그인</p><p>Nest 프로젝트를 생성합니다.</p><pre>$ nest new with-nest</pre><p>Heroku 에서 구동시 필요한 포트로 수정합니다.</p><pre>$ vi src/main.ts<br>async function bootstrap() {<br>  const app = await NestFactory.create(AppModule);<br>  await app.listen(process.env.PORT || 3000);<br>}</pre><p>Heroku 에서 구동시 호출하는 스크립트 설정을 추가합니다.</p><pre>$ vi package.json<br>…<br>    “prestart:prod”: “rimraf dist &amp;&amp; npm run build”,<br>    “web”: “npm run start:prod”,<br>…<br># Procfile<br>$ vi Procfile<br>web: npm run start:prod</pre><p>Procfile 에 설정되어 있으면 package.json 에서 web 스크립트는 삭제해도 됩니다.</p><p>Heorku 실행 환경 설정을 합니다.</p><pre># typescript 컴파일시 devDependency 필요<br>$ heroku config:set NPM_CONFIG_PRODUCTION=false<br>$ heroku config:set NODE_ENV=production</pre><p>로컬에서 실행하여 확인합니다.</p><pre>$ heroku local web</pre><p>정상적으로 구동된다면 Heroku Git에 커밋합니다.</p><pre>$ heroku git:remote -a HEROKU_APP_ID<br>$ git add .<br>$ git commit -m “make it better”<br>$ git push heroku master</pre><p>배포된 사이트를 확인합니다.</p><pre>$ heroku open</pre><h4>참고</h4><p>[Documentation | NestJS — A progressive Node.js framework](<a href="https://docs.nestjs.com/cli/overview">https://docs.nestjs.com/cli/overview</a>)<br>[The Heroku CLI | Heroku Dev Center](<a href="https://devcenter.heroku.com/articles/heroku-cli">https://devcenter.heroku.com/articles/heroku-cli</a>)<br>[Deploying a Production NestJS Server on Heroku | joshmorony — Learn Ionic &amp; Build Mobile Apps with Web Tech](<a href="https://www.joshmorony.com/deploying-a-production-nestjs-server-on-heroku/">https://www.joshmorony.com/deploying-a-production-nestjs-server-on-heroku/</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4d9f6199281" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Next.js 맛보기]]></title>
            <link>https://medium.com/@feedbotstar/next-js-%EB%A7%9B%EB%B3%B4%EA%B8%B0-e2100f037860?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2100f037860</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[next]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 04:26:25 GMT</pubDate>
            <atom:updated>2020-04-24T13:49:53.507Z</atom:updated>
            <content:encoded><![CDATA[<p>30분만 해보기</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLhv0sDPNqdTXfHahzmgww.png" /></figure><p>React 로 웹사이트를 만들 때 SEO 관련처리를 할 때가 있습니다. 나중에 SSR을 직접 구현하는 방법도 있겠지만 처음부터 Next.js를 사용하면 편리할 것 같습니다.</p><h4>Next.js 설치</h4><pre>$ mkdir firstblood &amp;&amp; cd firstblood<br>$ npm init -y<br>$ npm react react-dom next</pre><p>실행 스크립트 추가</p><pre>$ vi package.json<br>  &quot;scripts&quot;: {<br>         &quot;dev&quot;: &quot;next&quot;,<br>         &quot;build&quot;: &quot;next build&quot;,<br>         &quot;start&quot;: &quot;next start&quot;<br>  },</pre><h4>index 페이지 추가</h4><pre>$ mkdir -p src/pages src/components</pre><pre>$ vi src/pages/index.js<br>const Index = () =&gt; (<br>    &lt;div&gt;<br>        &lt;p&gt;index page&lt;/p&gt;<br>    &lt;/div&gt;<br>);<br>export default Index;<br>$ npm run dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*x5-pAbqxJvjGPMX7KqqlLQ.png" /></figure><h4>페이지 이동하기</h4><p>index에서 Link를 생성합니다.</p><pre>$ vi src/pages/index.js<br>import Link from &#39;next/link&#39;;</pre><pre>const ProfileLink = ({userId, name}) =&gt; (<br>    &lt;div&gt;<br>        &lt;Link href={{ <br>            pathname: `/members/detail`, <br>            query: { name: `${name}`, userId: `${userId}` }}}<br>            as={`/members/${userId}`}<br>            &gt;<br>            &lt;a&gt;{name} 회원의 프로필&lt;/a&gt;<br>        &lt;/Link&gt;<br>    &lt;/div&gt;<br>);</pre><pre>const Index = () =&gt; (<br>    &lt;div&gt;<br>        &lt;h1&gt;회원목록&lt;/h1&gt;<br>        &lt;ProfileLink userId=&quot;1001&quot; name=&quot;왕세자&quot;&gt;&lt;/ProfileLink&gt;<br>    &lt;/div&gt;<br>);<br>export default Index;</pre><p>src/pages/index.js 가 ‘/’ path 이고 <br>src/pages/members 디렉토리를 생성하여 ‘/members’ path 으로 매핑합니다.<br>src/pages/members/detail.js 파일을 생성하여 새로운 페이지로 이동합니다.<br>Url Object 의 query 에 파라미터를 전달합니다. 웹브라우저의 주소창에 표시되는 URL은 as 에 표현합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*ZsX7mmk1QFiGA5LUkVaRtw.png" /></figure><p>전체 페이지를 렌더링할 새로운 페이지를 작성합니다.</p><pre>$ mkdir -p src/pages/members<br>$ vi src/pages/members/detail.js<br><br>import { useRouter } from &quot;next/router&quot;;</pre><pre>export default function MemberView() {<br>    const router = useRouter();<br>    return (<br>        &lt;&gt;<br>            &lt;h1&gt;회원정보 페이지&lt;/h1&gt;<br>            &lt;p&gt;아이디: {router.query.userId}, 이름: {router.query.name} 님의 프로필.&lt;/p&gt;<br>        &lt;/&gt;<br>    );<br>}</pre><p>전달받은 파라미터는 useRouter 함수를 통해 이용할 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*UpcZ0sayTBLXwSdNidbQuA.png" /></figure><p>전체 페이지에 공통으로 적용할 수 있는 Document, App 과 에러페이지는 다음과 같이 작성합니다.</p><pre># typescript, styled-components 설치 후<br># Custom Document 를 생성할 경우<br>$ vi src/pages/_document.tsx<br>import Document, { DocumentContext } from &#39;next/document&#39;<br>import { ServerStyleSheet } from &#39;styled-components&#39;<br>import flush from &#39;styled-jsx/server&#39;</pre><pre>export default class extends Document {<br>  static async getInitialProps(ctx: DocumentContext) {<br>    const sheet = new ServerStyleSheet()<br>    const originalRenderPage = ctx.renderPage</pre><pre>try {<br>      ctx.renderPage = () =&gt;<br>        originalRenderPage({<br>          enhanceApp: App =&gt; props =&gt; sheet.collectStyles(&lt;App {...props} /&gt;),<br>        })</pre><pre>const initialProps = await Document.getInitialProps(ctx)<br>      return {<br>        ...initialProps,<br>        styles: (<br>          &lt;&gt;<br>            {/* {initialProps.styles} */}<br>            {sheet.getStyleElement()}<br>            {flush() || null}<br>          &lt;/&gt;<br>        ),<br>      }<br>    } finally {<br>      sheet.seal()<br>    }<br>  }<br>}</pre><pre># Custom App 를 생성할 경우<br>$ vi src/pages/_app.tsx<br>import Head from &#39;next/head&#39;;<br>import { AppProps } from &#39;next/app&#39;<br>import React from &#39;react&#39;;</pre><pre>const globalStyles = `<br>* {<br>    box-sizing: border-box;<br>    margin: 0;<br>    padding: 0;<br>}<br>`<br>export default function MainApp ({Component, pageProps} : AppProps) {<br>      return (<br>        &lt;&gt;<br>            &lt;Head&gt;<br>                &lt;meta charSet=&quot;utf-8&quot; /&gt;<br>                &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no&quot; /&gt;<br>                &lt;style type=&#39;text/css&#39;&gt;{globalStyles}&lt;/style&gt;<br>                &lt;link href=&quot;/styles/main.css&quot; rel=&quot;stylesheet&quot; /&gt;<br>            &lt;/Head&gt;<br>            &lt;Component {...pageProps} /&gt;<br>        &lt;/&gt;<br>      );<br>}</pre><pre># 에러페이지를 생성할 경우<br>$ vi src/pages/_error.tsx<br>export default function Custom404() {<br>    return &lt;h1&gt;Page Not Found&lt;/h1&gt;<br>}</pre><p>이만 산책하러 가야겠습니다.</p><h4>참고</h4><p><a href="https://nextjs.org/docs/getting-started">https://nextjs.org/docs/getting-started</a><br><a href="https://nextjs.org/docs/api-reference/next/link">https://nextjs.org/docs/api-reference/next/link</a><br><a href="https://nextjs.org/docs/advanced-features/custom-document">https://nextjs.org/docs/advanced-features/custom-document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2100f037860" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[vue cli 3 로 프로젝트 만들기]]></title>
            <link>https://medium.com/@feedbotstar/vue-cli-3-%EB%A1%9C-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EB%A7%8C%EB%93%A4%EA%B8%B0-9606bb247270?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/9606bb247270</guid>
            <category><![CDATA[vue-cli-3]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[plugins]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 07:17:36 GMT</pubDate>
            <atom:updated>2019-08-14T07:18:56.064Z</atom:updated>
            <content:encoded><![CDATA[<h4>vue cli 맛보기</h4><h4>들어가기</h4><p>vue cli 를 활용해서 프로젝트를 만들어보겠습니다.</p><h4>생성하기</h4><pre>$ mkdir cli &amp;&amp; cd cli<br>$ vue create .<br>$ npm run serve</pre><p>생성된 프로젝트 구조는 다음과 같습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*xIafriJhQKtO9lJ754blTw.png" /></figure><h4>플러그인 설치하기</h4><p>vue 플러그인은 다음과 같이 설치후 사용할 수 있습니다.</p><pre>$ vue add vuetify<br>$ vue add axios<br>$ vue add i18n<br>…</pre><p>vue 플러그인 목록을 한 번에 조회할 수 있다면 좋겠는데 ‘vue search’ 이런 명령 도구는 찾을 수 없었습니다. 대신 vue 프로젝트 관리 도구의 플러그인 메뉴에서 확인할 수 있습니다.</p><pre>$ vue ui</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*waN8zeM5tJt5TUeIwcOG7w.png" /></figure><h4>마치며</h4><p>vue cli 3 개발 도구를 활용하면 개발 환경 구성에 시간을 낭비를 줄일 수 있어서 좋습니다. (IDE 를 활용하면 더 쉽겠지만)</p><h4>참고</h4><ul><li>[CLI Service | Vue CLI](<a href="https://cli.vuejs.org/guide/cli-service.html#using-the-binary">https://cli.vuejs.org/guide/cli-service.html#using-the-binary</a>)</li><li>[Plugins and Presets | Vue CLI](<a href="https://cli.vuejs.org/guide/plugins-and-presets.html#installing-plugins-in-an-existing-project">https://cli.vuejs.org/guide/plugins-and-presets.html#installing-plugins-in-an-existing-project</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9606bb247270" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[vue-cli 3 빠른 프로토타이핑 시작하기]]></title>
            <link>https://medium.com/@feedbotstar/vue-cli-3-%EB%B9%A0%EB%A5%B8-%ED%94%84%EB%A1%9C%ED%86%A0%ED%83%80%EC%9D%B4%ED%95%91-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0-eda7ba8856fc?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/eda7ba8856fc</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vue-cli-3]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 06:57:56 GMT</pubDate>
            <atom:updated>2019-08-14T07:00:54.757Z</atom:updated>
            <content:encoded><![CDATA[<h4>10분만 해보기</h4><h4>들어가기</h4><p>vue-cli 3 에 빠른 프로토타이핑(Instant Prototyping)을 이용해서 브라우저에 ‘hello vue’를 출력하겠습니다.</p><h4>작업 시작!</h4><p>작업 공간을 생성하고 vue-cli 도구를 설치합니다.</p><pre>$ mkdir hello &amp;&amp; cd hello<br>$ npm init -y<br>$ npm i -g <a href="http://twitter.com/vue/cli">@vue/cli</a> <a href="http://twitter.com/vue/cli-service-global">@vue/cli-service-global</a><br>$ vue -V</pre><p>테스트용 파일을 생성합니다.</p><pre>$ mkdir src<br>$ vi src/App.vue<br>&lt;template&gt;<br>&lt;h1&gt;Hello vue&lt;/h1&gt;<br>&lt;/template&gt;</pre><p>브라우저에서 확인합니다.</p><pre>$ vue serve src/App.vue -o</pre><p>간단히 스타일도 추가해 봅니다.</p><pre>$ vi src/App.vue<br>&lt;template&gt;<br>&lt;h1 class=”title”&gt;Hello vue&lt;/h1&gt;<br>&lt;/template&gt;</pre><pre>&lt;style scoped&gt;<br>* { margin: 0; padding: 0; box-sizing: border-box; }<br>.title { background-color: MediumSeaGreen; }</pre><p>편집을 마치고 저장하면 브라우저에 변경 사항을 바로 확인할 수 있습니다.</p><p>간단한 스크립트도 작성해서 결과를 확인해 봅니다.</p><pre>&lt;template&gt;<br>&lt;h1 class=”title”&gt;{{ message }}&lt;/h1&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  data() {<br>   return {<br>     message: ‘Hello vue’<br>   }<br>  }<br>}<br>&lt;/script&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*rfbH1-ei1zIZboxiWXq2fg.png" /></figure><h4>마치며</h4><p>빠른 프로토타이핑을 돕는 ’vue serve’ 도구는 아이디어를 시험해 볼 때 유용합니다. 산책하러 가야겠습니다~</p><h4>참고</h4><ul><li>[Overview | Vue CLI](<a href="https://cli.vuejs.org/guide/#components-of-the-system">https://cli.vuejs.org/guide/#components-of-the-system</a>)</li><li>[Instant Prototyping | Vue CLI](<a href="https://cli.vuejs.org/guide/prototyping.html">https://cli.vuejs.org/guide/prototyping.html</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eda7ba8856fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[rollup.js 웹개발 설정하기]]></title>
            <link>https://medium.com/@feedbotstar/rollup-js-%EC%9B%B9%EA%B0%9C%EB%B0%9C-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0-82013b364b1e?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/82013b364b1e</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[babel-7]]></category>
            <category><![CDATA[rollupjs]]></category>
            <category><![CDATA[browsersync]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Thu, 08 Aug 2019 09:01:49 GMT</pubDate>
            <atom:updated>2019-08-09T07:43:27.016Z</atom:updated>
            <content:encoded><![CDATA[<p>기본적인 웹개발 설정을 해보겠습니다.</p><h3>설치</h3><p>프로젝트 디렉토리를 생성하고 rollup을 설치합니다.</p><pre>$ mkdir web &amp;&amp; cd web<br>$ mkdir src dist<br>$ npm init -y<br>$ npm i rollup</pre><p>먼저, rollup 설정 파일을 생성합니다.</p><pre>$ vi rollup.config.js</pre><pre>default export {<br>  input: &#39;./src/index.js&#39;,<br>  output: {<br>    file: &#39;./dist/bundle.js&#39;,<br>    format: &#39;umd&#39;<br>  }<br>};</pre><p>테스트 파일을 생성합니다.</p><pre>$ vi src/index.js</pre><pre>document.body.textContent = &#39;hello rollup&#39;;</pre><p>빌드 작업을 생성합니다.</p><pre>$ vi package.json</pre><pre>&quot;scripts&quot;: {<br>    &quot;build&quot;: &quot;rollup -c -w&quot;<br>}</pre><p>rollup으로 번들이 생성되는지 확인합니다.</p><pre>$ npm run build<br>$ cat dist/bundle.js</pre><h3>플러그인 설정</h3><p>rollup 에 확장할 기능은 플러그인으로 추가할 수 있습니다. 그 중에 웹 개발에 필요한 몇 가지 도구를 설치하고 설정하는 작업을 진행합니다.</p><ul><li>rollup-plugin-node-resolve : 외부 노드 모듈을 사용시 (node_modules 디렉토리)</li><li>rollup-plugin-commonjs : 외부 노드 모듈이 es6 으로 변환되지 않았을 경우 es6 으로 변환</li><li>rollup-plugin-browsersync : 번들 디렉토리의 변경사항을 웹브라우저에 반영</li><li>rollup-plugin-generate-html-template : index.html에 번들 스크립트 추가하여 생성</li><li>rollup-plugin-babel : babel 변환 지원</li><li>rollup-plugin-postcss : postcss 도구 지원</li><li>rollup-plugin-eslint : 코드 스타일 검사</li><li>rollup-plugin-uglify : 번들 파일 난독화</li></ul><h4>빌드 플러그인</h4><p>플러그인을 설치합니다.</p><pre>$ npm i rollup-plugin-browsersync rollup-plugin-generate-html-template</pre><p>플러그인 설정을 추가합니다.</p><pre>$ vi rollup.config.js</pre><pre>default export {<br> input : &#39;src/index.js&#39;,<br>    output : {<br>        file : &#39;dist/bundle.js&#39;,<br>        format : &#39;umd&#39;<br>    },<br>    plugins : [<br>        browsersync({<br>            server : &#39;dist&#39;<br>        }),<br>        html({<br>            template : &#39;src/index.html&#39;,<br>            target : &#39;dist/index.html&#39;<br>        })<br>    ]<br>};</pre><p>index.html 파일을 생성합니다.</p><pre>$ vi src/index.html</pre><pre>&lt;!doctype html&gt;<br>&lt;html lang=&quot;ko&quot;&gt;<br>&lt;head&gt;&lt;meta charset=&quot;utf-8&quot;&gt;&lt;title&gt;hello rollup&lt;/title&gt;&lt;/head&gt;<br>&lt;body&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>빌드 후 ‘hello rollup’이 브라우저에 출력되는지 확인합니다.</p><pre>$ npm run build</pre><p>index.js 수정한 후 저장할 때마다 브라우저에 수정 사항이 반영되는지 확인합니다.</p><h4>외부 모듈 변환 플러그인</h4><p>플러그인을 설치합니다.</p><pre>$ npm i rollup-plugin-node-resolve rollup-plugin-commonjs</pre><p>플러그인 설정을 추가합니다.</p><pre>$ vi rollup.config.js</pre><pre>...<br>import resolve from &#39;rollup-plugin-node-resolve&#39;;<br>import commonjs from &#39;rollup-plugin-commonjs&#39;;</pre><pre>default export {<br> ...<br>    plugins : [<br>     ...<br>        resolve(),<br>        commonjs({<br>            include : &#39;node_modules/**&#39;<br>        }),<br>}</pre><h4>Babel 변환 플러그인</h4><p>플러그인과 babel 7을 설치합니다.</p><pre>$ npm i <a href="http://twitter.com/babel/core">@babel/core</a> <a href="http://twitter.com/babel/cli">@babel/cli</a> <a href="http://twitter.com/babel/preset-env">@babel/preset-env</a><br>$ npm i <a href="http://twitter.com/babel/plugin-transform-runtime">@babel/plugin-transform-runtime</a> regenerator-runtime<br>$ npm i rollup-plugin-babel</pre><p>먼저, babel 설정을 추가합니다.</p><pre>$ vi .babelrc</pre><pre>{<br>    &quot;presets&quot; : [<br>        [ &quot;<a href="http://twitter.com/babel/env">@babel/env</a>&quot;, {<br>            modules : false,<br>            useBuiltIns : &quot;usage&quot;,<br>            corejs : 3<br>        }]<br>    ]<br>}</pre><p>rollup 플러그인 설정을 추가합니다.</p><pre>$ vi rollup.config.js</pre><pre>...<br>import babel from &#39;rollup-plugin-babel&#39;;</pre><pre>default export {<br> ...<br>    plugins : [<br>     ...<br>     babel({<br>            exclude : &#39;node_modules/**&#39;<br>        }),<br>}</pre><p>테스트용 index.js 를 다시 작성합니다.</p><pre>$ vi src/index.js</pre><pre>const text  = &#39;rollup&#39;;</pre><pre>async function say() {<br>    return `Hello ${text} async`;<br>}</pre><pre>const main = async () =&gt; {<br>    const message = await say();<br>    document.body.textContent = message;<br>    console.log(message);<br>}</pre><pre>main().catch(console.error)</pre><p>빌드 후 ‘Hello rollup async’이 브라우저에 출력되는지 확인합니다.</p><h4>CSS 플러그인</h4><p>플러그인과 기본 css 를 설치합니다.</p><pre>$ npm i rollup-plugin-postcss postcss-import autoprefixer<br>$ npm i reset-css normalize.css</pre><p>플러그인 설정을 추가합니다.</p><pre>$ vi rollup.config.js</pre><pre>...<br>import cssimport from &#39;postcss-import&#39;;<br>import autoprefixer from &#39;autoprefixer&#39;;</pre><pre>default export {<br>    plugins : [<br>     ...<br>     postcss({<br>            plugins : [ cssimport(), autoprefixer() ]<br>     })        <br>}</pre><p>변환시 지원할 브라우저를 지정합니다.</p><pre>$ vi package.json</pre><pre>{ ...<br>  },<br>  &quot;browserslist&quot;: [<br>    &quot;defaults&quot;<br>  ]<br>}</pre><p>테스트 css를 작성합니다.</p><pre>$ vi src/index.css</pre><pre><a href="http://twitter.com/charset">@charset</a> &quot;utf-8&quot;;<br><a href="http://twitter.com/import">@import</a> &quot;reset-css&quot;;<br><a href="http://twitter.com/import">@import</a> &quot;normalize.css&quot;;</pre><pre>* {<br>    box-sizing: border-box;<br>}<br>body {<br>    font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;<br>    color: #333;<br>    background-color: #f0f3f4;<br>}<br>li { list-style: none; }<br>a { text-decoration: none; }</pre><pre>.hello {<br>    font-size: 17px;<br>}<br>.test-autoprefixer {<br>    display: grid;<br>    transition: all .5s;<br>    user-select: none;<br>    background: linear-gradient(to bottom, white, black);<br>}</pre><p>테스트 파일을 다시 작성합니다.</p><pre>$ vi src/index.js</pre><pre>import style from &#39;./index.css&#39;;</pre><pre>const text  = &#39;rollup&#39;;</pre><pre>async function say() {<br>    return `Hello ${text} async`;<br>}</pre><pre>const main = async () =&gt; {<br>    const message = await say();<br>    console.log(message);</pre><pre>const body = document.querySelector(&quot;body&quot;);<br>    const greeting = document.createElement(&quot;div&quot;);<br>    greeting.innerText = message;<br>    greeting.classList.add(&quot;hello&quot;);<br>    body.appendChild(greeting);<br>    console.log(greeting.outerHTML);</pre><pre>const test = document.createElement(&quot;div&quot;);<br>    test.innerText = &quot;Test prefixer&quot;;<br>    test.classList.add(&quot;test-autoprefixer&quot;);<br>    body.appendChild(test);<br>    console.log(test.outerHTML);<br>}</pre><pre>main().catch(console.error)</pre><p>빌드 후 ‘Test prefixer’가 브라우저에 출력되는지 확인합니다.</p><pre>$ npm run build</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*YM0ENwUx4-omU73Dkc1omw.png" /></figure><p>다른 플러그인은 아래의 사이트에서 확인할 수 있습니다.</p><p><a href="https://github.com/rollup/awesome">GitHub - rollup/awesome: ⚡️ Delightful Rollup Plugins, Packages, and Resources</a></p><p>무덥지만 산책하러 가야겠습니다~</p><p>참고</p><p>- <a href="https://rollupjs.org/guide/en/#quick-start">https://rollupjs.org/guide/en/#quick-start</a><br>- <a href="https://blog.imaginea.com/comparing-javascript-module-bundlers-webpack-rollup-or-parcel/">https://blog.imaginea.com/comparing-javascript-module-bundlers-webpack-rollup-or-parcel/</a><br>- <a href="https://github.com/rollup/awesome">https://github.com/rollup/awesome</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82013b364b1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[rollup.js 10분만 맛보기]]></title>
            <link>https://medium.com/@feedbotstar/rollup-js-10%EB%B6%84%EB%A7%8C-%EB%A7%9B%EB%B3%B4%EA%B8%B0-a61fe4d7ad7f?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/a61fe4d7ad7f</guid>
            <category><![CDATA[module-bundler]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rollupjs]]></category>
            <category><![CDATA[webpack]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Sun, 04 Aug 2019 21:26:01 GMT</pubDate>
            <atom:updated>2019-08-09T07:42:17.305Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sL2YvECHDHrIScsVGC7TA.png" /></figure><p>r<a href="https://rollupjs.org/">ollup.js</a> 는 자바스크립트 번들러입니다.</p><p>간단히 웹브라우저에 ‘hello rollup’ 를 찍어 보려고 합니다.</p><p>rollup.js 은</p><ul><li>webpack 보다 설정이 간단하고 변환 속도가 빠름.</li><li>tree-shaking (정적 분석 후 중복된 함수나 모듈을 제거)으로 번들 사이즈를 작게 생성.</li></ul><p>합니다. (webpack4 에서도 큰 개선이 이뤄졌다고…)</p><h4>설치하기</h4><pre>$ mkdir test &amp;&amp; cd test<br>$ npm init -y<br>$ npm i rollup</pre><h4>설정하기</h4><pre>$ mkdir src dist<br>$ vi rollup.config.js</pre><p>rollup.js 설정 파일은 rollup.config.js 이며 직접 생성하고 편집해야 합니다. (webpack-cli init 이런 도구는 찾지 못했습니다.)</p><pre>export default {<br>    input: &#39;./src/index.js&#39;,<br>    output: {<br>        file: &#39;./dist/bundle.js&#39;,<br>        format: &#39;iife&#39;<br>    }<br>}</pre><h4>테스트</h4><p>테스트 페이지를 생성하겠습니다.</p><pre>$ vi src/index.html</pre><pre>&lt;!doctype html&gt;<br>&lt;html lang=&quot;ko&quot;&gt;<br>&lt;head&gt;&lt;meta charset=&quot;utf-8&quot;&gt;&lt;title&gt;hello rollup&lt;/title&gt;&lt;/head&gt;<br>&lt;body&gt;<br>&lt;script src=&quot;../dist/bundle.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><pre>$ vi src/index.js</pre><pre>document.body.textContent = &quot;hello rollup&quot;;</pre><p>빌드 작업을 만듭니다.</p><pre>$ vi package.json</pre><pre>&quot;scripts&quot;: {<br>    <strong>&quot;build&quot;: &quot;rollup -c&quot;</strong><br>}</pre><p>변환 작업을 수행합니다.</p><pre>$ npm run build</pre><p>rollup 번들러가 src/index.js 파일을 지정한 포멧으로 변환하여 dist/bundle.js 에 생성합니다.</p><pre>$ cat dist/bundle.js</pre><p>웹 브라우저에서 src/index.html 파일을 열어서 확인합니다.</p><pre>$ open -a Firefox src/index.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*1PIWMm2mcjb6ycbDc5t5QA.png" /></figure><p>산책하러 가야겠습니다.</p><p>참고</p><p>- <a href="https://devinduct.com/cheatsheet/15/rollup">https://devinduct.com/cheatsheet/15/rollup</a><br>- <a href="https://devinduct.com/blogpost/9/how-to-setup-rollup-config">https://devinduct.com/blogpost/9/how-to-setup-rollup-config</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a61fe4d7ad7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chatfuel 로 고객 피드백을 이메일로 보내는 챗봇 만들기]]></title>
            <link>https://medium.com/@feedbotstar/chatfuel-%EB%A1%9C-%EC%9D%B4%EB%A9%94%EC%9D%BC-%EC%A0%80%EC%9E%A5%ED%95%98%EB%8A%94-%EC%B1%97%EB%B4%87-%EB%A7%8C%EB%93%A4%EA%B8%B0-9180cf7e0dcd?source=rss-efee28f020fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/9180cf7e0dcd</guid>
            <category><![CDATA[facebook-messenger]]></category>
            <category><![CDATA[customer-service]]></category>
            <category><![CDATA[chatfuel]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[readbetweenthelines]]></dc:creator>
            <pubDate>Sun, 23 Apr 2017 08:51:14 GMT</pubDate>
            <atom:updated>2017-04-23T09:43:53.302Z</atom:updated>
            <content:encoded><![CDATA[<h4>1시간만 해보기</h4><p>Chatfuel 로 사용자로부터 서비스 만족도 피드백을 받아서 그 내용을 이메일 로 보내는 챗봇을 만들려고 합니다.</p><p>준비해야할 사항은 다음과 같습니다.</p><ul><li>페이스북 계정 및 챗봇으로 사용할 페이스북 페이지 1개 생성</li><li>Chatfuel 계정 생성</li></ul><p>먼저 대화 흐름 설계를 합니다.</p><p>서울에서 호텔을 이용한 고객의 피드백을 받고 그 내용을 자동으로 이메일로 받는 상황을 가정합니다.</p><p>텍스트로 BOT과 USER 스크립트를 작성합니다.</p><pre>B: 안녕하세요. {{페북사용자이름}}님!. 저희 프립 호텔을 이용해 주셔서 감사합니다. 편안한 시간 되셨기를 바랍니다. 고객님께 최고의 서비스를 제공하기 위해 몇 가지 질문에 응답을 해 주시면 대단히 감사하겠습니다. 준비되셨지요?<br>U: 네.<br>B: 고객님이 머무시는 동안 저희가 제공해 드린 서비스가 전체적으로 어떠했나요?<br>U: ... {{feedback:review}} <br>B: 감사합니다. 저희가 제공한 서비스가 어떤 점을 더 개선하면 좋을까요? 구체적으로 말씀해 주시면 고맙겠습니다.<br>U: ... {{feedback:didnotlike}}<br>B: 감사합니다. 머무시는 기간 동안 가장 만족스러운 점이 있다면 어떤 것이 있었나요? 구체적으로 말씀해 주시면 고맙겠습니다.<br>U: ... {{feedback:likeit}}</pre><p>이제 Chatfuel 도구로 옮겨 봅니다.</p><p>chatfuel.com 에 로그인 후 빈 챗봇을 하나 생성합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*iAp0QNbikkTaCrN4N15Tww.png" /></figure><p>생성해 놓은 페이스북 페이지에 연결합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*vriK-WDjW_uLQVleC5Uung.png" /></figure><p>먼저 BOT 의 ‘1.1 환영 메시지&#39;를 텍스트를 입력합니다. ‘Welcome message’ 블럭 이름을 클릭하면 제목도 수정할 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*ql9saTAG0XTW8JqaRt-qXA.png" /></figure><p>chatfuel 에서 제공하는 속성은 ‘{{‘ 입력하면 자동 추천됩니다.</p><p>‘+ADD BUTTON’ 을 클릭하여 사용자가 선택할 수 있는 응답을 블럭으로 작성합니다. 블럭을 먼저 만들지 않았다면 텍스트 입력시 ‘+Create … Block’ 을 클릭하면 블럭을 생성해 줍니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*TpOg2dQIRiMCLa98wp2YFQ.png" /></figure><p>이제 왼쪽에 생성된 ‘2.2 사용자 입력’ 을 클릭해서 고객 의견을 수집하는 폼을 만듭니다. 하단에 카드 블럭 타입 중에 ‘PLUGIN’을 선택한 다음 ‘User Input’ 플러그인을 선택합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*qJpvEJON3ZiMNl7iGj4ybg.png" /></figure><p>고객 의견을 수집하는 질문과 고객 응답 내용을 저장할 사용자 속성(USER_ATTRIBUTE)만들어 짝을 지어 입력합니다.</p><ul><li>고객님이 머무시는 동안 저희가 제공해 드린 서비스가 전체적으로 어떠했나요? = {{feedback::review}}</li><li>감사합니다. 저희가 제공한 서비스가 어떤 점을 더 개선하면 좋을까요? 구체적으로 말씀해 주시면 고맙겠습니다. = {{feedback::didnotlike}}</li><li>감사합니다. 머무시는 기간 동안 가장 만족스러운 점이 있다면 어떤 것이 있었나요? 구체적으로 말씀해 주시면 고맙겠습니다. = {{feedback::likeit}}</li></ul><p>사용자가 입력한 내용을 이메일로 보내는 카드 블럭을 작성합니다. 하단에 카드 블럭 타입 중에 ‘PLUGIN’을 선택한 다음 ‘Send Email’ 플러그인을 선택합니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*H-jML3LUWvxNgTNeQt8GHw.png" /></figure><p>이메일 제목과 주소 그리고 사용자 응답 내용을 보내도록 내용을 작성합니다. ‘User Input’ 블럭에서 작성한 USER_ATTRIBUTE를 사용하면 고객이 챗봇 메신저에 입력한 내용을 이메일로 받을 수 있습니다.</p><pre>TITLE:<br>[CS봇]{{first name}} {{last name}} 님이 보낸 설문 응답</pre><pre>EMAIL ADDRESS:<br><a href="/service/mailto:cs@friphotel.com">cs@yourcompany.com</a></pre><pre>EMAIL BODY:<br>CS봇에서 수집한 고객 설문 응답<br>====================================<br>feedback:review = {{feedback:review}}<br>feedback:didnotlike = {{feedback:didnotlike}}<br>feedback:likeit = {{feedback:likeit}}<br>====================================</pre><p>이제 잘 작동하는지 ‘TEST THIS CHATBOT’ 버튼을 클릭하여 페이스북 메신저에서 확인해 봅니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*rMMjus6qmL6jNg9CCoSHpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*lke_agFLtMPNnt8UQb0sXQ.png" /></figure><p>입력한 내용이 설정한 메일로 도착했는지 확인해봅니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zu59R_w2mf6PItfsGERFDw.png" /></figure><p>이제 산책하러 가야겠습니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9180cf7e0dcd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>