0
0

More than 1 year has passed since last update.

JSONServerを立ち上げてみた

Posted at

Vueで簡単なアプリを作成するために必要となるJSONServerを立ち上げました。

ターミナルでnpm i json-serverを実行しインストール、サーバー用のディレクトリを作成してそこにjsonファイルを配置しました。

db.json
{
    "todos":[
        {
            "id":1,
            "text":"Vueのプログラミング",
            "categoryId":1
        },
        {
            "id":2,
            "text":"寝る",
            "categoryId":1
        },
        {
            "id":3,
            "text":"買い物",
            "categoryId":2
        }
    ],
    "categories":[
        {
            "id":1,
            "title":"未着手"
        },
        {
            "id":2,
            "title":"完了"
        }
    ]
}

サーバー用のフォルダに移動し、ターミナルでnpx json-server --watch db.jsonを実行するとサーバーが立ち上がりました。
image.png

これからこの仕組みを使ってアプリを作っていきます。

0
0
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
0
0