Skip to content

Commit d258e38

Browse files
committed
update functionly, readmes
1 parent c4864aa commit d258e38

19 files changed

+58
-55
lines changed

README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
# project config
2-
create a functionly.json file into your project
3-
## example:
1+
# Functionly examples
2+
## Functionly configuration
3+
The `functionly.json` contains the default configuration of the CLI, just create this file in the project root.
4+
5+
### example:
46
```js
57
{
68
"awsRegion": "us-east-1",
7-
"main": "./lib/todoDb.js",
9+
"main": "./src/index.js",
810
"deployTarget": "aws",
911
"localPort": 3000,
10-
"stage": "dev"
12+
"stage": "dev",
13+
"watch": true,
14+
"compile": "babel-loader"
1115
}
1216
```
13-
# functionly-examples
17+
18+
## Javascript
19+
- [greeter](https://github.com/jaystack/functionly-examples/tree/master/greeter)
20+
- [todoDB](https://github.com/jaystack/functionly-examples/tree/master/todoDB-es6)
1421

1522
## Typescript
1623
- [todoDB](https://github.com/jaystack/functionly-examples/tree/master/todoDB)
1724
- [todoDB-mongo](https://github.com/jaystack/functionly-examples/tree/master/todoDB-mongo)
1825
- [todoDBAdvanced](https://github.com/jaystack/functionly-examples/tree/master/todoDBAdvanced)
1926
- [eventSource](https://github.com/jaystack/functionly-examples/tree/master/eventSource)
20-
21-
## ES6
22-
- [greeter](https://github.com/jaystack/functionly-examples/tree/master/greeter)
23-
- [todoDB-es6](https://github.com/jaystack/functionly-examples/tree/master/todoDB-es6)

eventSource/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eventSource/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
},
2424
"dependencies": {
2525
"shortid": "^2.2.8",
26-
"functionly": "0.0.42"
26+
"functionly": "0.0.44"
2727
}
2828
}

eventSource/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class CaptureScheduleEvent extends FunctionalService {
7878

7979

8080

81-
@rest({ path: '/createItem', anonymous: true })
81+
@rest({ path: '/createItem' })
8282
export class CreateItem extends FunctionalService {
8383
public static async handle(
8484
@param name,

greeter/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

greeter/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"babel-preset-functionly-aws": "^1.0.1"
2323
},
2424
"dependencies": {
25-
"functionly": "0.0.42"
25+
"functionly": "0.0.44"
2626
}
2727
}

todoDB-es6/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ export class GetAllTodos extends TodoService {
7979
static async handle() {}
8080
}
8181
```
82-
If you want your service to be accessible with a web request over a rest interface then you have to decorate it with the [rest]() decorator. We need a `path` and have to set the `cors` and the `anonymous` properties to `true` because we want to call it without authentication and from another domain.
82+
If you want your service to be accessible with a web request over a rest interface then you have to decorate it with the [rest]() decorator. We have to set the `path` property to define the rest endpoint. If we do not set the `methods` property that means it will accept `GET` requests. (default: `methods: ['get']`)
8383
```js
84-
@rest({ path: '/getAllTodos', cors: true, anonymous: true })
84+
@rest({ path: '/getAllTodos' })
8585
```
8686
Define a [description]() for the `TodoService`, which will make it easier to find in the AWS Lambda list.
8787
```js
8888
@description('get all Todo service')
8989
```
90-
Now we have to create the business logic. We want to read the todo items, so we need to inject the `TodoTable`. Get the items from it and return from our service. If we do not set the `methods` property that means it will accept `GET` requests. (default: `methods: ['get']`)
90+
Now we have to create the business logic. We want to read the todo items, so we need to inject the `TodoTable`. Get the items from it and return from our service.
9191
```js
9292
import { rest, description, inject } from 'functionly'
9393

94-
@rest({ path: '/getAllTodos', cors: true, anonymous: true })
94+
@rest({ path: '/getAllTodos' })
9595
@description('get all Todo service')
9696
export class GetAllTodos extends TodoService {
9797
static async handle(@inject(TodoTable) db) {
@@ -110,7 +110,7 @@ We need a service to create todo items, so let's do this. We will also define a
110110
```js
111111
import { rest, description } from 'functionly'
112112

113-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true, cors: true })
113+
@rest({ path: '/createTodo', methods: ['post'] })
114114
@description('create Todo service')
115115
export class CreateTodo extends TodoService {
116116
static async handle() {}
@@ -120,7 +120,7 @@ We need some values to create a new todo item: `name`, `description` and `status
120120
```js
121121
import { rest, description, param } from 'functionly'
122122

123-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true, cors: true })
123+
@rest({ path: '/createTodo', methods: ['post'] })
124124
@description('create Todo service')
125125
export class CreateTodo extends TodoService {
126126
static async handle(@param name, @param description, @param staus) {}
@@ -131,7 +131,7 @@ The business logic: save a new todo item. [Inject]() the `TodoTable` and save a
131131
import { generate } from 'shortid'
132132
import { rest, description, param } from 'functionly'
133133

134-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true, cors: true })
134+
@rest({ path: '/createTodo', methods: ['post'] })
135135
@description('create Todo service')
136136
export class CreateTodo extends TodoService {
137137
static async handle(@param name, @param description, @param status, @inject(TodoTable) db) {
@@ -195,7 +195,7 @@ export class PersistTodo extends Service {
195195
```js
196196
import { rest, description, param, inject } from 'functionly'
197197

198-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true, cors: true })
198+
@rest({ path: '/createTodo', methods: ['post'] })
199199
@description('create Todo service')
200200
export class CreateTodo extends TodoService {
201201
static async handle(

todoDB-es6/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

todoDB-es6/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"babel-preset-functionly-aws": "^1.0.1"
2222
},
2323
"dependencies": {
24-
"functionly": "0.0.42",
24+
"functionly": "0.0.44",
2525
"shortid": "^2.2.8"
2626
}
2727
}

todoDB-es6/src/todoDB.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class PersistTodo extends Service {
3636
}
3737

3838

39-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true, cors: true })
39+
@rest({ path: '/createTodo', methods: ['post'] })
4040
@description('create Todo service')
4141
export class CreateTodo extends TodoService {
4242
static async handle(
@@ -57,7 +57,7 @@ export class CreateTodo extends TodoService {
5757

5858

5959

60-
@rest({ path: '/getAllTodos', cors: true, anonymous: true })
60+
@rest({ path: '/getAllTodos' })
6161
@description('get all Todo service')
6262
export class GetAllTodos extends TodoService {
6363
static async handle(@inject(TodoTable) db) {

todoDB-mongo/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

todoDB-mongo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
},
2525
"dependencies": {
2626
"shortid": "^2.2.8",
27-
"functionly": "0.0.42"
27+
"functionly": "0.0.44"
2828
}
2929
}

todoDB-mongo/src/todoDB.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class PersistTodo extends TodoService {
5151
}
5252

5353

54-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true })
54+
@rest({ path: '/createTodo', methods: ['post'] })
5555
@description('create Todo service')
5656
export class CreateTodo extends TodoService {
5757

@@ -73,7 +73,7 @@ export class CreateTodo extends TodoService {
7373

7474

7575

76-
@rest({ path: '/getAllTodos', cors: true, anonymous: true })
76+
@rest({ path: '/getAllTodos' })
7777
@description('get all Todo service')
7878
export class GetAllTodos extends TodoService {
7979

todoDB/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

todoDB/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
},
2525
"dependencies": {
2626
"shortid": "^2.2.8",
27-
"functionly": "0.0.42"
27+
"functionly": "0.0.44"
2828
}
2929
}

todoDB/src/todoDB.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class PersistTodo extends Service {
3636
}
3737

3838

39-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true, cors: true })
39+
@rest({ path: '/createTodo', methods: ['post'] })
4040
@description('create Todo service')
4141
export class CreateTodo extends TodoService {
4242
public static async handle(
@@ -57,7 +57,7 @@ export class CreateTodo extends TodoService {
5757

5858

5959

60-
@rest({ path: '/getAllTodos', cors: true, anonymous: true })
60+
@rest({ path: '/getAllTodos' })
6161
@description('get all Todo service')
6262
export class GetAllTodos extends TodoService {
6363
public static async handle(@inject(TodoTable) db: TodoTable) {

todoDBAdvanced/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

todoDBAdvanced/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
},
2525
"dependencies": {
2626
"shortid": "^2.2.8",
27-
"functionly": "0.0.42"
27+
"functionly": "0.0.44"
2828
}
2929
}

todoDBAdvanced/src/todoDB.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class PersistTodo extends TodoService {
6666
}
6767

6868

69-
@rest({ path: '/createTodo', methods: ['post'], anonymous: true })
69+
@rest({ path: '/createTodo', methods: ['post'] })
7070
@description('create Todo service')
7171
export class CreateTodo extends TodoService {
7272

@@ -86,7 +86,7 @@ export class CreateTodo extends TodoService {
8686

8787
}
8888

89-
@rest({ path: '/getAllTodos', cors: true, anonymous: true })
89+
@rest({ path: '/getAllTodos' })
9090
@description('get all Todo service')
9191
export class GetAllTodos extends TodoService {
9292

0 commit comments

Comments
 (0)