Giter Club home page Giter Club logo

serverless-cnode's Introduction

Serverless Cnode

在线预览

使用 Next.js + TypeScript 开发,并且基于 Serverless 部署的 cnode 客户端

流程图

Deploy Flow

功能

  • Typescript
  • Next.js
  • 自定义 Express Server
  • LRU Render Cache
  • 基于 Serverless Next.js 组件部署
  • 静态资源分离,自动部署到 COS
  • 自动为静态 COS 配置 CDN
  • node_modules 基于层部署,大大提高部署效率

本地开发

$ npm install

$ npm run dev

构建

$ npm run build

配置

在部署到 Serverless 前,将 .env.example 重命名为 .env,并请完成如下配置:

# 腾讯云授权密钥
TENCENT_APP_ID=xxx
TENCENT_SECRET_ID=xxx
TENCENT_SECRET_KEY=xxx

# 部署地区
REGION=ap-guangzhou

# 静态资源上传 COS 桶名称
BUCKET=serverless-cnode

# API 网关自定义域名 和 证书 ID
APIGW_CUSTOM_DOMAIN=cnode.yuga.chat
APIGW_CUSTOM_DOMAIN_CERTID=xxx

# CDN 域名,证书 ID
CDN_DOMAIN=static.cnode.yuga.chat
CDN_DOMAIN_CERTID=xxx

注意:如果不需要使用 CDN,直接使用 COS 自动生成的域名,也是可以的,只需要删除 serverless.yml 中的 cdnConf 即可。

部署

此项目会先将 node_modules 部署到 ,然后在部署项目代码, 这样下次部署项目时,如果 node_modules 没有修改,我们就不需要部署庞大的 node_modules 文件夹了。

  1. 部署层:
$ npm run deploy:layer

注意:如果项目 node_modules 没有变更,就不需要执行此命令。

  1. 部署业务代码:
$ npm run deploy

License

MIT

serverless-cnode's People

Contributors

yugasun avatar dependabot[bot] avatar

Watchers

James Cloos 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.