Skip to content

Releases: Danilqa/node-file-router

v0.6.0

24 Feb 11:34
Compare
Choose a tag to compare

What's new

Features

Added the ability to modify or override a final result in middlewares (#41).

For example, you can now set response headers in Bun inside middlewares:

import type { NextFunction } from 'node-file-router';

export async function useCors(req: Request, next: NextFunction<Response>) {
  const res = await next();

  res.headers.set('Access-Control-Allow-Methods', 'PUT, POST, OPTIONS, HEAD');

  return res;
}

Documentation

v0.5.2

30 Jan 08:39
Compare
Choose a tag to compare

What's new

Important Fixes

Added a proper route params processing in the middlewares (#35).

For instance, the following code will now work correctly:

// file: api/users/[id].[post].js
async function useMyMiddleware(req: Request, next: NextFunction, routeParams: Record<string, string>) {
  // routeParams now have values here
  await next();
}

async function createOrUpdateUser(req: Request, routeParams: RouteParams) {
  // As well as here
}

export default [
  useMyMiddleware,
  createOrUpdateUser,
];

Documentation

Added information about this update.

v0.5.1

22 Jan 09:56
250cf04
Compare
Choose a tag to compare

What's new

Important Fixes

Fixed the issue with the TypeScript import declaration (#31).

Documentation

  1. Added examples of using Bun with TypeScript.
  2. Added a section about the usage of shared state.

v0.5.0

16 Jan 16:47
Compare
Choose a tag to compare

What's new

Middlewares (#18)
It allows you to write additional logic before and after requests. For instance, it enables tasks such as authentication verification, request logging, error handling, and more. You can apply middleware to the entire application, to specific route handler, or to a group of routes within a folder.

See how it works on the website

Thanks @EvHaus for the suggestion! #25

v0.4.0

11 Nov 08:41
Compare
Choose a tag to compare

What's new

Clear Import Cache (#18)
It allows you to re-import updated files during the service runtime.
See how it works on the website

Thank you @coxmi for suggestion! #13

Website
Moved images to the CDN. The page loading speed has increased.

v0.3.1

11 Oct 09:43
f79f2dd
Compare
Choose a tag to compare

What's new

Improved readme (#9)
Now, it's easier to understand what's going on in the library.

Development

Linter improvement (#8)

  • No more weird not related warnings in interfaces about not used variables.
  • Added linter for commit messages: conventional commits.

v0.3.0

03 Oct 12:32
9f2cc58
Compare
Choose a tag to compare

What's new

1. Methods in Filenames (#6)
You can now specify a method in filenames, which works with all route types. For example, login.[post].ts, [id].[patch].ts, and even [...tags].[get].ts! For more information, refer to the new section in the documentation. Thanks, @angelhdzmultimedia, for this awesome idea.

2. Ability to use catch-all in the middle of the URL (#7)
Now, the image-proxy/[...operations]/url/[image].ts is valid.