LoginSignup
0
0

More than 1 year has passed since last update.

Nuxtインストール・セットアップ方法

Posted at

DRF+Nuxt+MySQLな環境を作るための備忘録
作業ログ的な感じなので説明省いてますので質問がある方はコメントください。

インストール

yarnをイントール

$ npm install -g yarn

プロジェクト作成
※ 使うUIやネットワークは各々

$ yarn create nuxt-app nuxt

セットアップ

nuxt/nuxt.config.js
追加対応、ホスト・ポート

export default {
...
	server: {
	    host: '0.0.0.0',
	    port: 80
	},
...

言語対応

  head: {
    htmlAttrs: {
      lang: 'ja'
    },

Ajax対応
※ 通信はAxiosを使う、ホスト・ポートはAPI用Dockerで設定したものを使う web:8000

axios: {
    proxy: true,
    baseURL: "http://web:8000",
  },
  proxy: {
    '/api/': {
      target: "http://web:8000"
    }
  },

起動

## Dev
$ yarn dev

## ビルド
$ yarn build

## 実行
$ yarn start
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