Skip to content

Commit

Permalink
Merge pull request #13 from GiovanniCardamone/dev
Browse files Browse the repository at this point in the history
release 1.0.5
  • Loading branch information
GiovanniCardamone authored Aug 9, 2020
2 parents 94c9a56 + eda6248 commit 953d7d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.5] - 2020-08-09

### Changed

- Handling routes creation without creating new object (decrease memory usage)

## [1.0.4] - 2020-08-08

## [1.0.3] - 2020-08-08
Expand All @@ -17,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.0.1] - 2020-08-07

### Addedd
### Added

- documentation

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fastify-autoroutes",
"version": "1.0.4",
"version": "1.0.5",
"description": "Map directory structure to routes",
"main": "dist/index.js",
"scripts": {
Expand Down
15 changes: 6 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,12 @@ function autoload(

const routes = module(fastify)

for (const [meth, route] of Object.entries<AnyRoute>(routes)) {
if (validMethods.includes(meth)) {
const method: ValidMethods = meth.toUpperCase() as ValidMethods

fastify.route({
url,
method,
...route,
})
for (const [method, route] of Object.entries<RouteOptions>(routes)) {
if (validMethods.includes(method)) {
route.url = url
route.method = method.toUpperCase() as ValidMethods

fastify.route(route)

if (log) {
console.info(`${method.toUpperCase()} ${url} => ${fullPath}`)
Expand Down

0 comments on commit 953d7d5

Please sign in to comment.