5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Next.jsAdvent Calendar 2019

Day 23

Zeit Now で Nest.js 使って HelloWlrld!

Posted at

概要

Zeit Now でHelloWorld!を表示してみました!
5分ほどでデプロイできました。
めっちゃ簡単。

無料でも使える!
image.png

準備

下記よりユーザー登録
https://zeit.co/onboarding

nowコマンドをインストール


$ npm i -g now

now login を実行し、emailより、認証を行う。

$ now login

sample-app作成


$ npx create-next-app sample-app
$ cd sample-app

sample-app デプロイ

詳細な設定は不要で、now コマンドのみでデプロイできる!


$ now
> Deploying ~/tmp_test/sample-app under hayashikengojp
> Using project sample-app
> Synced 1 file [534ms]
> NOTE: This is the first deployment in the sample-app project. It will be promoted to production.
> NOTE: To deploy to production in the future, run `now --prod`.
> https://sample-app-1bcic4d43.now.sh [3s]
> Ready! Deployment complete [28s]
- https://sample-app.now.sh
- https://sample-app.hayashikengojp.now.sh [in clipboard]

$ open https://sample-app-1bcic4d43.now.sh/

image.png

HelloWorld表示

pages/hello.js追加。
pages 配下にファイルを置くとルーティングしてくれる。


import React from "react";

import Nav from "../components/nav";

const Hello = () => (
  <div>
    <Nav />
    <p>HelloWorld!</p>
  </div>
);

export default Hello;

now コマンドで実行


$ now
now
> Deploying ~/tmp_test/sample-app under hayashikengojp
> Using project sample-app
> Synced 1 file [852ms]
> https://sample-app-w4eczjs3g.now.sh [4s]
> Ready! Deployed to https://sample-app.hayashikengojp.now.sh [in clipboard] [29s]

$ https://sample-app-w4eczjs3g.now.sh/hello

image.png

カスタムドメイン設定もでき、ブログなど静的なサイトなど作る際はかなりお手軽に作れる。
しかも無料枠で結構使える。
今回作成したsample-appこちら

参照

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?