Git Product home page Git Product logo

movie-demo-next's Introduction

初始化项目

npm init next-app movie-demo-next

# 安装chakra
npm i @chakra-ui/react @emotion/react @emotion/styled framer-motion

# 安装主题
npm i @chakra-ui/theme

# 安装字体图标
npm install react-icons --save

# 安装 babel
npm install @babel/core

# emotion 预警
npm install @emotion/babel-preset-css-prop

# 运行
npm run dev

导出静态网站

配置脚本: "export": "next build && next export"

npm run export

将输出的out文件夹内容,放置到服务器下

自定义Next应用服务器

创建 server 文件夹 安装express: npm i express nodemon 创建服务器入口index.js

const express = require('express')
const next = require('next')

const dev = process.env.NODE_ENV !== 'production'

const app = next({ dev })

const handler = app.getRequestHandler()

app.prepare().then(() => {
	const server = express()
	server.get('/hello', (req, res) => {
		res.send('Hello Next.js')
	})
	server.get('*', (req, res) => {
		handler(req, res)
	})
	server.listen(3000, () => console.log('服务器启动成功'))
})

修改启动脚本: "dev": "nodemon server/index.js"

部署到 vercel 平台

movie-demo-next's People

Contributors

sylvanase avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.