port 4201 + port 3001 for api + some fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, Post } from '@nestjs/common';
|
||||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@@ -7,7 +7,7 @@ export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Post()
|
||||
async sendEMail(@Body() mailInfo: {name:string,email:String,message:string}): Promise<void> {
|
||||
async sendEMail(@Body() mailInfo: {name:string,email:string,message:string}): Promise<void> {
|
||||
return await this.appService.sendMail(mailInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||
import { join } from 'path';
|
||||
import { MailerService } from '@nestjs-modules/mailer';
|
||||
import { z,ZodError } from 'zod';
|
||||
export const SenderSchema = z.object({
|
||||
@@ -13,7 +12,7 @@ export class AppService {
|
||||
constructor(
|
||||
private mailerService: MailerService,
|
||||
) {}
|
||||
async sendMail(mailInfo: {name:string,email:String,message:string}): Promise<void> {
|
||||
async sendMail(mailInfo: {name:string,email:string,message:string}): Promise<void> {
|
||||
try {
|
||||
SenderSchema.parse(mailInfo);
|
||||
} catch (error) {
|
||||
|
||||
@@ -17,7 +17,7 @@ async function bootstrap() {
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
allowedHeaders: 'Content-Type, Accept, Authorization, x-hide-loading',
|
||||
});
|
||||
const port = 3000;//process.env.PORT || 3000;
|
||||
const port = 3001;//process.env.PORT || 3000;
|
||||
await app.listen(port);
|
||||
Logger.log(
|
||||
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
|
||||
|
||||
Reference in New Issue
Block a user