Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
M-jerez committed Jan 24, 2024
1 parent 7dc077c commit c73cde1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 42 deletions.
8 changes: 1 addition & 7 deletions packages/quick-start/src/myApi.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ export const routes = {
delete: (ctx, id: string): string => id,
create: (ctx, newOrder: Omit<Order, 'id'>): Order => ({id: 'ORDER-123', ...newOrder}),
},
utils: {
sum: (ctx, a: number, b: number): number => a + b,
sayHello: (ctx, user: User): string => `Hello ${user.name} ${user.surname}`,
},
log: {
forceRunOnError: true,
hook: (ctx): void => {
const now = Date.now();
console.log(now, ctx.path, ctx.response.statusCode);
if (ctx.request.internalErrors.length) console.error(now, ctx.path, ctx.request.internalErrors);
console.log(Date.now(), ctx.path, ctx.response.statusCode);
},
},
} satisfies Routes;
Expand Down
10 changes: 3 additions & 7 deletions website/content/1.introduction/2.quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,10 @@ export const routes = {
delete: (ctx, id: string): string => id,
create: (ctx, newOrder: Omit<Order, 'id'>): Order => ({id: 'ORDER-123', ...newOrder}),
},
utils: {
sum: (ctx, a: number, b: number): number => a + b,
sayHello: (ctx, user: User): string => `Hello ${user.name} ${user.surname}`,
},
log: {
forceRunOnError: true,
hook: (ctx): void => {
const now = Date.now();
console.log(now, ctx.path, ctx.response.statusCode);
if (ctx.request.internalErrors.length) console.error(now, ctx.path, ctx.request.internalErrors);
console.log(Date.now(), ctx.path, ctx.response.statusCode);
},
},
} satisfies Routes;
Expand Down Expand Up @@ -187,6 +181,8 @@ npm install @mionkit/client
- Use your API.
::

To consume a Type Safe Api we just need to import **only** the type of our mion API so no code from the API is actually imported.

<!-- embedme ../../../packages/client/examples/client.ts -->

```ts
Expand Down
8 changes: 1 addition & 7 deletions website/content/3.platforms/1.node-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,10 @@ export const routes = {
delete: (ctx, id: string): string => id,
create: (ctx, newOrder: Omit<Order, 'id'>): Order => ({id: 'ORDER-123', ...newOrder}),
},
utils: {
sum: (ctx, a: number, b: number): number => a + b,
sayHello: (ctx, user: User): string => `Hello ${user.name} ${user.surname}`,
},
log: {
forceRunOnError: true,
hook: (ctx): void => {
const now = Date.now();
console.log(now, ctx.path, ctx.response.statusCode);
if (ctx.request.internalErrors.length) console.error(now, ctx.path, ctx.request.internalErrors);
console.log(Date.now(), ctx.path, ctx.response.statusCode);
},
},
} satisfies Routes;
Expand Down
8 changes: 1 addition & 7 deletions website/content/3.platforms/2.bun.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,10 @@ export const routes = {
delete: (ctx, id: string): string => id,
create: (ctx, newOrder: Omit<Order, 'id'>): Order => ({id: 'ORDER-123', ...newOrder}),
},
utils: {
sum: (ctx, a: number, b: number): number => a + b,
sayHello: (ctx, user: User): string => `Hello ${user.name} ${user.surname}`,
},
log: {
forceRunOnError: true,
hook: (ctx): void => {
const now = Date.now();
console.log(now, ctx.path, ctx.response.statusCode);
if (ctx.request.internalErrors.length) console.error(now, ctx.path, ctx.request.internalErrors);
console.log(Date.now(), ctx.path, ctx.response.statusCode);
},
},
} satisfies Routes;
Expand Down
8 changes: 1 addition & 7 deletions website/content/3.platforms/3.aws-lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ export const routes = {
delete: (ctx, id: string): string => id,
create: (ctx, newOrder: Omit<Order, 'id'>): Order => ({id: 'ORDER-123', ...newOrder}),
},
utils: {
sum: (ctx, a: number, b: number): number => a + b,
sayHello: (ctx, user: User): string => `Hello ${user.name} ${user.surname}`,
},
log: {
forceRunOnError: true,
hook: (ctx): void => {
const now = Date.now();
console.log(now, ctx.path, ctx.response.statusCode);
if (ctx.request.internalErrors.length) console.error(now, ctx.path, ctx.request.internalErrors);
console.log(Date.now(), ctx.path, ctx.response.statusCode);
},
},
} satisfies Routes;
Expand Down
8 changes: 1 addition & 7 deletions website/content/3.platforms/4.google-cloud-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ export const routes = {
delete: (ctx, id: string): string => id,
create: (ctx, newOrder: Omit<Order, 'id'>): Order => ({id: 'ORDER-123', ...newOrder}),
},
utils: {
sum: (ctx, a: number, b: number): number => a + b,
sayHello: (ctx, user: User): string => `Hello ${user.name} ${user.surname}`,
},
log: {
forceRunOnError: true,
hook: (ctx): void => {
const now = Date.now();
console.log(now, ctx.path, ctx.response.statusCode);
if (ctx.request.internalErrors.length) console.error(now, ctx.path, ctx.request.internalErrors);
console.log(Date.now(), ctx.path, ctx.response.statusCode);
},
},
} satisfies Routes;
Expand Down

0 comments on commit c73cde1

Please sign in to comment.