Skip to content
This repository was archived by the owner on Nov 22, 2025. It is now read-only.

Release v0.2.0 - 2017-09-06

Choose a tag to compare

@shirohana shirohana released this 06 Sep 10:55
· 151 commits to dev since this release
v0.2.0

Added

  • ✨ Custom aliases
const options = {
  aliases: [
    'db/model', // Resolve `~model` from {srcDir}/db/model
    { from: 'error', to: 'src/server/error' }, // Resolve `~error` from {srcDir}/src/server/error
    'lib/utils/index.js' // Resolve `~utils` from {srcDir}/lib/utils/index.js
  ]
}
// Then you can use
import User from '~model/user'
import SomeError from '~error/some-error'
import { kebabCase } from '~utils'
// You can still use `~/` to resolve from {srcDir}
  • ✨ Dynamic watcher

By default, Watcher watches all files in routesDir and files imported by them, requests will pending until all related files build done.

Changed

  • ✂️ Extract implicit watch() from Builder.build() when dev:true
// Before => dev:true ? watch() : build()
import { Builder } from 'dynapi'
new Builder(dynapi).build().then(...)

// Now => Use `Watcher` if you want to watch, use `Builder` if you just want to build once on start up
import { Builder, Watcher } from 'dynapi'
new Watcher(dynapi).watch().then(...)
new Builder(dynapi).build().then(...)

// No difference to use dynapi.middleware
app.use('/api', dynapi.middleware())
  • 🔧 Options (apiDirname -> routesDir)
  • Internal refactoring, it would break your code if you're using:
    • Dynapi#resolve
    • Dynapi#relativeFrom
    • Dynapi#redirectTo

Removed

  • Drop options controllerDirname (use aliases)