Code Monkey home page Code Monkey logo

kidjs's Introduction

概述

简单好用的 Next.js 自定义服务器。

为什么使用服务端渲染?

  • 能够为客户提供更理想的性能;
  • 提供更为一致的 SEO 表现;

为什么使用 Kid.js

Kid.js 为 Next.js 提供更加人性化的后端服务能力,支持自定义路由和接口、环境配置等功能。同时不破坏 Next.js 原有的特性及开发体验。

Kid.js 作为 Next.js 的附加服务,与 Next.js 本身不存在耦合,可随时被添加至一个现有的 Next.js 应用中,并可以在任何时候从你的应用中移除。

在技术选型上使用性能优异的 Koa 作为底层。

在安全和稳定性方面,Kid.js 内置常见攻击的防御机制。

Kid.js 关注服务端渲染的性能,默认开启页面级缓存。

特性

  • 基于 Koa.js 开发,性能优异;
  • 页面级缓存;
  • 配置化开发和部署;

快速入门

启动一个新的项目

我们只需要几个步骤,就可以让你的服务运行起来:

$ npm i --save kidjs next react react-dom

在你的 package.json 中添加运行脚本:

{
  "scripts": {
    "dev": "kid",
    "build": "kid build",
    "start": "KID_ENV=prod kid"
  }
}

创建首页(.pages/index.js):

export default () => <div>Welcome to kid.js!</div>

启动项目:

$ npm run dev
$ open 127.0.0.1:7214

在 Next.js 中使用 Kid.js

$ npm i --save kidjs

在配置中声明自定义端口(可选):

// config/config.default.js

module.exports = {
  port: 7707
}

更改 package.json 中的运行脚本:

{
  "scripts": {
    "dev": "kid",
    "build": "kid build",
    "start": "KID_ENV=prod kid"
  }
}

启动项目:

$ npm run dev
$ open 127.0.0.1:7707

LICENSE

Kid.js 采用 MIT 开源许可。

Kid.js 关注企业和项目的版权风险,所有依赖的框架和库均采用 MIT 许可,并对依赖进行扫描。

kidjs's People

Contributors

boizz avatar

Stargazers

徐帅武 avatar Neil avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

kidjs's Issues

body

添加 koa-body 中间件支持 POST 请求

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.