docs
migration
Migration from 2.x

Migration from 2.x

v2 features may not work in v3. In order to upgrade an existing server to v3, you must apply the changes in v3.

#Packages

All actions were performed in the zely module, but the method has changed to the @zely-js/~ module sharing the responsibility for actions.

packagedescription
zelyre-exports of @zely-js/zely and zely-cli
zely-clizely cli
@zely-js/zelycore module of zely
@zely-js/corezely server
@zely-js/loaderjavascript loader manager
@zely-js/loader-esbuildesbuild loader (to load typescript)

To use zely and cli together, install zely. If you only want to use zely API, install @zely-js/zely.

#File Structure

$routing is deprecated.

beforeafter
/index.ts/index.ts
/a/b.ts/a/b.ts
/book/$id.ts/book/[id].ts
/$id/about.ts/[id]/about.ts
~/[...params].ts

#Migration

  1. change (req, res) => ... to (ctx) => ... in handlers.

The export handler can also use context.

INFO

Check the context document
Typescript
// export function get(req, res) {}
export function get(ctx) {
  const req = ctx.request;
  const res = ctx.response;
  // ...
}
  1. remove snatcher.

snatcher has been deprecated. Use fetch instead.

  1. remove $page.path

$page.path is not supported in 3.0.

  1. replace zely/~ with zely.
beforeafter
zely/configzely
zely/methodszely