Add packages/common

This commit is contained in:
Jerko Steiner 2019-01-18 20:33:41 +01:00
parent a46a2d28bf
commit 076ec515d3
4 changed files with 63 additions and 21 deletions

View File

@ -0,0 +1,4 @@
{
"name": "@rondo/common",
"private": true
}

View File

@ -0,0 +1,36 @@
export interface IAPIDef {
'/auth/register': {
'post': {
body: {
username: string
password: string
}
}
}
'/auth/login': {
'post': {
body: {
username: string
password: string
}
}
}
'/auth/logout': {
'get': {}
},
'/users/password': {
'post': {
body: {
oldPassword: string
newPassword: string
}
}
}
'/users/profile': {
'get': {
response: {
id: number
}
}
}
}

View File

@ -0,0 +1,21 @@
export type IMethod = 'get'
| 'post'
| 'put'
| 'delete'
| 'patch'
| 'head'
| 'options'
export interface IRoutes {
// has to be any because otherwise TypeScript will start
// throwing error and interfaces without an index signature
// would not be usable
[route: string]: any
}
export interface IRoute {
params: any
query: any
body: any
response: any
}

View File

@ -1,21 +1,2 @@
export type IMethod = 'get'
| 'post'
| 'put'
| 'delete'
| 'patch'
| 'head'
| 'options'
export interface IRoutes {
// has to be any because otherwise TypeScript will start
// throwing error and interfaces without an index signature
// would not be usable
[route: string]: any
}
export interface IRoute {
params: any
query: any
body: any
response: any
}
export * from './IRoutes'
export * from './IAPIDef'