Upgrade to Pro — share decks privately, control downloads, hide ads and more …

next.jsを使ったuniversal React 入門

Hori Godai
December 14, 2018

next.jsを使ったuniversal React 入門

Hori Godai

December 14, 2018
Tweet

More Decks by Hori Godai

Other Decks in Programming

Transcript

  1. TypeScriptを利用 Babelのpresetを下記のように記述 .babelrc "presets": [ "next/babel", "@zeit/next-typescript/babel" ], next.config.js const

    withTypescript = require('@zeit/next-typescript') const withCSS = require('@zeit/next-css') module.exports = withTypescript(withCSS());
  2. netlifyの lambda function の利用 package.json "scripts": { "lambda": "netlify-lambda build

    functions", "lambda-local": "netlify-lambda serve functions", }
  3. netlifyの lambda function の利用 記述例 exports.handler = async (event, context,

    callback) => { return callback(null, { statusCode: 200, headers: { 'Content-type': 'application/json' }, body: JSON.stringify({ test: 'hoge' }) }); };