Deploy app
This commit is contained in:
@@ -2,10 +2,11 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import testAuth from "../auth";
|
||||
import { StatusCodes } from "http-status-codes";
|
||||
import { deployApp, getDeployments } from "@/core/deployment";
|
||||
import { Application } from "@/lib/types";
|
||||
|
||||
export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
const auth = await testAuth(req);
|
||||
const { name, appId }: { name: string; appId: string } = await req.json();
|
||||
const { name, app }: { name: string; app: Application } = await req.json();
|
||||
|
||||
if (auth) {
|
||||
return NextResponse.json(
|
||||
@@ -14,14 +15,14 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
);
|
||||
}
|
||||
|
||||
if (!name || !appId) {
|
||||
if (!name || !app) {
|
||||
return NextResponse.json(
|
||||
{ message: "Body missing name, appId, nodeId" },
|
||||
{ status: StatusCodes.BAD_REQUEST }
|
||||
);
|
||||
}
|
||||
|
||||
const deployId = await deployApp(name, appId);
|
||||
const deployId = await deployApp(name, app);
|
||||
|
||||
return NextResponse.json({
|
||||
message: "ok",
|
||||
|
||||
Reference in New Issue
Block a user