Comparing version 1.1.6 to 1.1.7
{ | ||
"name": "santuy", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Santuy is a nextjs framework and SQL for auto generate data from model", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
@@ -19,2 +19,7 @@ # Santuy | ||
```ts | ||
//create database santuy | ||
CREATE DATABASE `santuy`; | ||
``` | ||
### Model | ||
@@ -259,2 +264,35 @@ | ||
} | ||
``` | ||
### Get Data | ||
```ts | ||
//file: api/get/route.ts | ||
//url: http://localhost:3000/api/get?model=users | ||
//url: http://localhost:3000/api/get?model=categories | ||
//url: http://localhost:3000/api/get?model=products | ||
import { NextResponse } from 'next/server'; | ||
import { NextRequest } from "next/server"; | ||
import { DatabaseType, get, GetType } from 'santuy'; | ||
export async function GET(request: NextRequest) { | ||
const database: DatabaseType = { | ||
host: "localhost", | ||
user: "root", | ||
password: "", | ||
port: 3306, | ||
database: "santuy", | ||
} | ||
const model = request.nextUrl.searchParams.get("model") || ""; | ||
const getData: GetType = { | ||
model, | ||
database | ||
} | ||
const response: any = await get(getData); | ||
if (!response) { | ||
return NextResponse.json("No Data!", { status: 400 }) | ||
} | ||
return NextResponse.json(response, { status: 200 }) | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13775
296