Skip to content

Commit

Permalink
Merge pull request #8 from GiovanniCardamone/dev
Browse files Browse the repository at this point in the history
Release 1.0.3
  • Loading branch information
GiovanniCardamone authored Aug 8, 2020
2 parents 2c9380d + 0adac3c commit 4e7edff
Show file tree
Hide file tree
Showing 16 changed files with 121 additions and 59 deletions.
22 changes: 9 additions & 13 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
"files": [
"README.md"
],
"projectName": "fastify-autoroutes",
"projectOwner": "GiovanniCardamone",
"repoType": "github",
"repoHost": "https://github.com",
"imageSize": 100,
"commit": false,
"commit": true,
"commitConvention": "none",
"contributors": [
{
"login": "GiovanniCardamone",
Expand All @@ -18,16 +23,7 @@
]
}
],
"projectName": "fastify-autoroutes",
"projectOwner": "GiovanniCardamone",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "none",
"contributors": [],
"contributorsPerLine": 7
"contributorsPerLine": 7,
"badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-green.svg?style=flat)](#contributors)",
"skipCi": "true"
}
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.dependabot
.github
.nyc_output
.vscode
coverage
docs
examples
tests
Expand Down
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributing to fastify-autoroutes

## Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

- (a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

- (b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

- (c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

- (d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ Licensed under [MIT](./LICENSE)

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

If you want to contribute remember to comment on an issue or pull request with:
@all-contributors please add @jakebolam for infrastructure, tests and code
> If you want to contribute remember to comment on an issue or pull request with:
`@all-contributors please add @jakebolam for infrastructure, tests and code`

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
Expand Down
50 changes: 11 additions & 39 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
# fastify-autoroutes

![CI workflow](https://github.com/GiovanniCardamone/fastify-autoroutes/workflows/CI%20workflow/badge.svg)

[![Known Vulnerabilities](https://snyk.io/test/github/GiovanniCardamone/fastify-autoroutes/badge.svg)](https://snyk.io/test/github/GiovanniCardamone/fastify-autoroutes)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-gren.svg?style=flat)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

Automatic add routes based on file system hierarchy

**[Full Documentation](https://giovannicardamone.github.io/fastify-autoroutes/)**

## :rocket: Install
## Install

```sh
npm install --save fastify-autoroutes
```

## :blue_book: Usage
## Usage

```js
const fastify = require('fastify')
Expand Down Expand Up @@ -60,7 +50,7 @@ export default (fastifyInstance) => {
}
```

## :arrow_forward: Accepted Methods in Module
## Accepted Methods in Module

- delete
- get
Expand All @@ -70,11 +60,11 @@ export default (fastifyInstance) => {
- put
- options

## :arrow_forward: Url Parameters using path name
## Url Parameters using path name

to use url parameters in your route use `{parmName}` in your file or directory, it will be automatically changet to fastify parameter

## :arrow_forward: Skip files in autoroutes directory
## Skip files in autoroutes directory

to skip file in routes directory, prepend the `.` or `_` charater to filename

Expand All @@ -89,32 +79,14 @@ examples:

this is useful if you want to have a lib file containts functions that don't have to be a route, so just create the file with `_` prepending character

## :arrows_clockwise: Changes

Check [CHANGELOG](./CHANGELOG.md)

## :page_facing_up: License

Licensed under [MIT](./LICENSE)

## :sparkles: Contributors
## Examples

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
- [Example javascript App](https://github.com/GiovanniCardamone/fastify-autoroutes/tree/master/examples/simple-js-app)
- [Example typescript App](https://github.com/GiovanniCardamone/fastify-autoroutes/tree/master/examples/simple-ts-app)

If you want to contribute remember to comment on an issue or pull request with:
@all-contributors please add @jakebolam for infrastructure, tests and code
## Contribute

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="http://giovannicardamone.github.io"><img src="https://avatars0.githubusercontent.com/u/5117748?v=4" width="100px;" alt=""/><br /><sub><b>Giovanni Cardamone</b></sub></a><br /><a href="https://github.com/GiovanniCardamone/fastify-autoroutes/commits?author=GiovanniCardamone" title="Code">💻</a> <a href="https://github.com/GiovanniCardamone/fastify-autoroutes/commits?author=GiovanniCardamone" title="Documentation">📖</a> <a href="#example-GiovanniCardamone" title="Examples">💡</a> <a href="#maintenance-GiovanniCardamone" title="Maintenance">🚧</a></td>
</tr>
</table>
To contribute to [fastify-autoroutes](https://github.com/GiovanniCardamone/fastify-autoroutes) please check the [CONTRIBUTING](https://github.com/GiovanniCardamone/fastify-autoroutes/master/CONTRIBUTING.md) file.

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
All contributions are apprecciated :smiley:

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
11 changes: 11 additions & 0 deletions examples/simple-js-app/routes/.ignored-route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import fastify, { FastifyInstance } from 'fastify'

export default (fastify) => {
return {
get: {
handler: (request, reply) => {
reply.send('i am ignored')
},
},
}
}
11 changes: 11 additions & 0 deletions examples/simple-js-app/routes/_ignored-route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import fastify, { FastifyInstance } from 'fastify'

export default (fastify) => {
return {
get: {
handler: (request, reply) => {
reply.send('i am ignored')
},
},
}
}
11 changes: 11 additions & 0 deletions examples/simple-js-app/routes/_igored-subpath/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import fastify, { FastifyInstance } from 'fastify'

export default (fastify) => {
return {
get: {
handler: (request, reply) => {
reply.send('i am ignored')
},
},
}
}
1 change: 0 additions & 1 deletion examples/simple-js-app/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../dist'

export default (fastify) => {
return {
Expand Down
1 change: 0 additions & 1 deletion examples/simple-js-app/routes/users/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../../dist'

export default (fastify) => {
return {
Expand Down
1 change: 0 additions & 1 deletion examples/simple-js-app/routes/users/{userId}/comments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../../../dist'

export default (fastify) => {
return {
Expand Down
1 change: 0 additions & 1 deletion examples/simple-js-app/routes/users/{userId}/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../../../dist'

export default (fastify) => {
return {
Expand Down
12 changes: 12 additions & 0 deletions examples/simple-ts-app/routes/.ignored-route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../dist'

export default (fastify) => {
return <Resource>{
get: {
handler: (request, reply) => {
reply.send('i am ignored')
},
},
}
}
12 changes: 12 additions & 0 deletions examples/simple-ts-app/routes/_ignored-route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../dist'

export default (fastify) => {
return <Resource>{
get: {
handler: (request, reply) => {
reply.send('i am ignored')
},
},
}
}
12 changes: 12 additions & 0 deletions examples/simple-ts-app/routes/_igored-subpath/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fastify, { FastifyInstance } from 'fastify'
import { Resource } from '../../../../dist'

export default (fastify) => {
return <Resource>{
get: {
handler: (request, reply) => {
reply.send('i am ignored')
},
},
}
}
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.2",
"version": "1.0.3",
"description": "Map directory structure to routes",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit 4e7edff

Please sign in to comment.