v7.2.0 (upcoming)
New Features:
new
commandit has never been easier to create a new app using one of our templates.
darkflare new
doc
commandgenerate a simple documentation for your api.
Spotify
andDiscord
oauth2 providersurl typesafety
a step forward to end-to-end typesafety.
v7.1.1
Changes:
you can now pass data between hooks using the
c.data
object. you can assign new keys to this object without causing type issues.fixed a type issue that made
decrypt
option in jwt module not optional.
v7.1.0
New Features:
hooks are now available.
hooks are functions that allow you to extend the functionality of a route and reuse functions throughout your app without having to write the same code over and over again.
import { Get } from 'darkflare' Get({ preValidator(c) { ... } }, c => { ... })
Changes:
we try to make the developer experience as smooth as possible. therefore, we’re going to integrate all modules exported under a different path into the core.
// darkflare/jwt import { jwt } from 'darkflare' jwt.sign() jwt.verify() // darkflare/authenticator import { authenticator } from 'darkflare' // encrypt/decrypt import { encrypt, decrypt } from 'darkflare'
v7.0.1
Changes:
- update guide and edit description in readme
v7.0.0
Breaking Changes:
removed
darkflare/s3
module.you should import and configure s3 on your own as this gives you much more flexibility.
encrypt()
/decrypt()
functions now require the secret as a parameter.removed custom error handlers.
the built-in error handler now responds with either json or plain text, based on the
accept
header of the incoming request.darkflare.yml
is now the file to configure darkflare and it’s fully optional to use one.most features require now specific environment variables to be set.
New Features:
cron trigger
you can now add a handler for the
ScheduledEvent
. create acron.ts
file in the root.import { cron } from 'darkflare' cron(c => { ... })
mail trigger
you can now add a handler for the
EmailEvent
. create amail.ts
file in the root.import { mail } from 'darkflare' mail(c => { ... })
DurableObjects
can now be used with darkflare.create a file named
*.object.ts
in the root directory.export class MyDurableObject implements DurableObject { }
Changes:
darkflare now uses drgn v0.5.2, which comes with automated updates.
you can now have
*.test.ts
/*.d.ts
files within the /api directory.before v7, darkflare threw an error in case the directory contained one of these files. now they get ignored.
v6.4.1
Bug Fixes:
- add missing export of
err
function todarkflare/x
module.
- add missing export of
v6.4.0
Notable Changes:
you should now configure your app this way.
configure
method is now deprecated and will be removed on the next breaking release.import { Darkflare } from 'https://deno.gg/darkflare@v6.4.0' new Darkflare({ name: 'my app', ... })
plus, your config file should now be named
darkflare.ts
without the dot.any utility functions are now available under
darkflare/x
.this includes:
encrypt()
decrypt()
parseUserAgent()
sendMail()
err()
New Features:
add authentication to your app using the new
oauth2
module.darkflare.ts
import { Darkflare } from 'https://deno.gg/darkflare@v6.4.0' new Darkflare({ oauth2: { github: { client_id: '{id}', client_secret: '{secret}', }, }, })
api/oauth2/github/login.ts
import { Get, v } from 'darkflare' import { Github } from 'darkflare/oauth2' Get({}, async (ctx) => { Github.redirect(ctx, ['read:user', 'user:email']) })
api/oauth2/github/callback.ts
import { Get, v } from 'https://deno.gg/darkflare@v6.4.0' import { Github } from 'https://deno.gg/darkflare@v6.4.0/oauth2' Get({ query: v.object({ code: v.string(), }), }, async ({ req }) => { const token = await Github.getAccessToken(req.query.code), user = await Github.getUser(token) return `Welcome, ${user.name}!` })
Changes:
deprecated
passThroughOnException
option.since darkflare is a API engine, it should never happen that you have to forward the request to an origin server, should an exception occur, since there cannot be an origin server on the same route/domain that darkflare is running on.
v6.3.1
Changes:
- patched dependencies.
v6.3.0
New Features:
easier error handling with the
err
function.import { err, Get } from 'darkflare' Get({}, (ctx) => { if (!ctx.req.headers.authentication) { return err('UNAUTHORIZED') // or: err(403) } return 'Welcome back!' })
{ "code": 403, "message": "Unauthorized" }
v6.2.1
Bug Fixes:
- undo recent addition of
env
export.
- undo recent addition of
v6.2.0
New Features:
access your environment variables completely stateless.
import { env } from 'https://deno.gg/darkflare@v6.2.0' export function func() { console.log(env) }
Bug Fixes:
no more usage of built-in Deno functions.
https://esm.sh/file-type@18.2.0
seemed to cause some unexpected imports.
v6.1.0
New Features:
exp
andnbf
options in jwt’ssign
method now automatically determine the seconds elapsed since midnight, January 1, 1970 UTC.
v6.0.1
Bug Fixes:
- cli should now work as expected
v6.0.0
Breaking Changes:
removed
Store
utilitywe recommend to use e.g. flare as an alternative.
removed
Webhook
utilityyou should know how to send a webhook. so this utility is pretty useless.
renamed
deploycommand to publishindex routes must now be named
mod.ts
(following Deno’s naming convention)jwt module now uses djwt under the hood
the module exports only two methods now:
sign
(create a new token) andverify
(validate tokens and return payload if it’s valid)
Bug Fixes:
realm-web
is only included in the bundle if you’re actually using it
New Features:
added
darkflare/authenticator
modulea easy and well-tested module for creating and validating one time passwords.
added
encrypt
anddecrypt
functionsencrypt/decrypt text using AES-GCM SHA-256.