This project has been deprecated. - Read Blog
Docs
Overview
Migration to dobs

Migration to dobs

Zely is no longer under active maintenance. Please use Dobs, a lightweight and actively updated version of Zely.

If you’re starting a new project, use the create-dobs tool to create a Dobs project. If you’re already using Zely, refer to the migration guide to move to Dobs.

#Installation

First, uninstall Zely and then install the Dobs package.

Terminal
yarn uninstall zely
yarn add dobs

#Configuration File

Rename zely.config.{js|ts} to dobs.config.{js|ts|json}.

Javascript
import { defineConfig } from "zely";
import { defineConfig } from "dobs";
export default defineConfig({
  server: {
    port: 3000,
  },
  port: 3000,
});

The currently supported Dobs config options (as of v0.0.1-alpha.6) are:

  • port
  • middlewares
  • createServer
  • cwd
  • mode
  • temp (=dist)
  • build

#Routes

Rename the /pages/ directory to /app/.

Route files (file-based routing) are compatible with Zely.

#Router

Typescript
import { defineRoutes } from "dobs";
 
export default [ALL((ctx) => {})];
export default defineRoutes((req, res) => {});

Change Zely’s array-style router to use defineRoutes() (or an object form).

Typescript
import { defineRoutes } from "dobs";
 
export default defineRoutes({
  ALL(req, res) {
    res.send("Hello Dobs");
  },
});

#Data Caching

Dobs uses a completely different approach to data caching compared to Zely.

Typescript
import { defineRoutes } from "dobs";
import { useCache } from "dobs/experimental";
 
export default defineRoutes(
  (req, res) => {
    res.send("Hello World!");
  },
  [useCache()] 
);

Add the useCache instance as the second argument (wrapper) to the defineRoutes() function.

#Conclusion

For more details, visit Github.