forked from nestjs/nest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fe7963
commit a2a00ad
Showing
104 changed files
with
1,464 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { Get, Controller, Res } from '@nestjs/common'; | ||
import { Get, Controller, Render } from '@nestjs/common'; | ||
|
||
@Controller() | ||
export class AppController { | ||
@Get() | ||
root(@Res() res) { | ||
res.render('index', { message: 'Hello world!' }); | ||
@Get() | ||
@Render('index') | ||
root() { | ||
return { message: 'Hello world!' }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
"packages": [ | ||
"lib/*" | ||
], | ||
"version": "4.6.0" | ||
"version": "4.5.9" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'reflect-metadata'; | ||
/** | ||
* Defines a template that should be rendered by a controller. | ||
*/ | ||
export declare function Render(template: string): MethodDecorator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("reflect-metadata"); | ||
const constants_1 = require("../../constants"); | ||
/** | ||
* Defines a template that should be rendered by a controller. | ||
*/ | ||
function Render(template) { | ||
return (target, key, descriptor) => { | ||
Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value); | ||
return descriptor; | ||
}; | ||
} | ||
exports.Render = Render; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ export declare enum RouteParamtypes { | |
PARAM = 5, | ||
HEADERS = 6, | ||
SESSION = 7, | ||
FILE = 8, | ||
FILES = 9, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare class HttpModule { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const module_decorator_1 = require("../decorators/modules/module.decorator"); | ||
const http_service_1 = require("./http.service"); | ||
let HttpModule = class HttpModule { | ||
}; | ||
HttpModule = __decorate([ | ||
module_decorator_1.Module({ | ||
components: [http_service_1.HttpService], | ||
exports: [http_service_1.HttpService], | ||
}) | ||
], HttpModule); | ||
exports.HttpModule = HttpModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { AxiosRequestConfig, AxiosResponse } from './interfaces/axios.interfaces'; | ||
import 'rxjs/add/observable/fromPromise'; | ||
export declare class HttpService { | ||
request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>>; | ||
get<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>; | ||
delete(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<any>>; | ||
head(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<any>>; | ||
post(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<any>>; | ||
put(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<any>>; | ||
patch(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<any>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const axios_1 = require("axios"); | ||
const Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/observable/fromPromise"); | ||
class HttpService { | ||
request(config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.request(config)); | ||
} | ||
get(url, config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url, config)); | ||
} | ||
delete(url, config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.delete(url, config)); | ||
} | ||
head(url, config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.head(url, config)); | ||
} | ||
post(url, data, config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.post(url, data, config)); | ||
} | ||
put(url, data, config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.post(url, data, config)); | ||
} | ||
patch(url, data, config) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.post(url, data, config)); | ||
} | ||
} | ||
exports.HttpService = HttpService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './http.module'; | ||
export * from './http.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./http.module")); | ||
__export(require("./http.service")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
export interface AxiosTransformer { | ||
(data: any, headers?: any): any; | ||
} | ||
export interface AxiosAdapter { | ||
(config: AxiosRequestConfig): AxiosPromise<any>; | ||
} | ||
export interface AxiosBasicCredentials { | ||
username: string; | ||
password: string; | ||
} | ||
export interface AxiosProxyConfig { | ||
host: string; | ||
port: number; | ||
} | ||
export interface AxiosRequestConfig { | ||
url?: string; | ||
method?: string; | ||
baseURL?: string; | ||
transformRequest?: AxiosTransformer | AxiosTransformer[]; | ||
transformResponse?: AxiosTransformer | AxiosTransformer[]; | ||
headers?: any; | ||
params?: any; | ||
paramsSerializer?: (params: any) => string; | ||
data?: any; | ||
timeout?: number; | ||
withCredentials?: boolean; | ||
adapter?: AxiosAdapter; | ||
auth?: AxiosBasicCredentials; | ||
responseType?: string; | ||
xsrfCookieName?: string; | ||
xsrfHeaderName?: string; | ||
onUploadProgress?: (progressEvent: any) => void; | ||
onDownloadProgress?: (progressEvent: any) => void; | ||
maxContentLength?: number; | ||
validateStatus?: (status: number) => boolean; | ||
maxRedirects?: number; | ||
httpAgent?: any; | ||
httpsAgent?: any; | ||
proxy?: AxiosProxyConfig; | ||
cancelToken?: CancelToken; | ||
} | ||
export interface AxiosResponse<T = any> { | ||
data: T; | ||
status: number; | ||
statusText: string; | ||
headers: any; | ||
config: AxiosRequestConfig; | ||
request?: any; | ||
} | ||
export interface AxiosError extends Error { | ||
config: AxiosRequestConfig; | ||
code?: string; | ||
request?: any; | ||
response?: AxiosResponse; | ||
} | ||
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> { | ||
} | ||
export interface CancelStatic { | ||
new (message?: string): Cancel; | ||
} | ||
export interface Cancel { | ||
message: string; | ||
} | ||
export interface Canceler { | ||
(message?: string): void; | ||
} | ||
export interface CancelTokenStatic { | ||
new (executor: (cancel: Canceler) => void): CancelToken; | ||
source(): CancelTokenSource; | ||
} | ||
export interface CancelToken { | ||
promise: Promise<Cancel>; | ||
reason?: Cancel; | ||
throwIfRequested(): void; | ||
} | ||
export interface CancelTokenSource { | ||
token: CancelToken; | ||
cancel: Canceler; | ||
} | ||
export interface AxiosInterceptorManager<V> { | ||
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number; | ||
eject(id: number): void; | ||
} | ||
export interface AxiosInstance { | ||
defaults: AxiosRequestConfig; | ||
interceptors: { | ||
request: AxiosInterceptorManager<AxiosRequestConfig>; | ||
response: AxiosInterceptorManager<AxiosResponse>; | ||
}; | ||
request<T = any>(config: AxiosRequestConfig): AxiosPromise<T>; | ||
get<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>; | ||
delete(url: string, config?: AxiosRequestConfig): AxiosPromise; | ||
head(url: string, config?: AxiosRequestConfig): AxiosPromise; | ||
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>; | ||
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>; | ||
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>; | ||
} | ||
export interface AxiosStatic extends AxiosInstance { | ||
(config: AxiosRequestConfig): AxiosPromise; | ||
(url: string, config?: AxiosRequestConfig): AxiosPromise; | ||
create(config?: AxiosRequestConfig): AxiosInstance; | ||
Cancel: CancelStatic; | ||
CancelToken: CancelTokenStatic; | ||
isCancel(value: any): boolean; | ||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>; | ||
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R; | ||
} | ||
declare const Axios: AxiosStatic; | ||
export default Axios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = Axios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { MulterOptions } from '../interfaces/external/multer-options.interface'; | ||
export declare function FileInterceptor(fieldName: string, options?: MulterOptions): { | ||
new (): { | ||
readonly upload: any; | ||
intercept(request: any, context: any, stream$: Observable<any>): Promise<Observable<any>>; | ||
}; | ||
}; |
Oops, something went wrong.