mirror of
https://github.com/edufeed-org/polloer.git
synced 2025-12-10 00:34:31 +00:00
25 lines
No EOL
648 B
JavaScript
25 lines
No EOL
648 B
JavaScript
import { json } from '@sveltejs/kit';
|
|
|
|
export async function POST({ request }) {
|
|
const data = await request.json();
|
|
|
|
// Here you would handle the data, e.g., save it to a database or process it
|
|
// For demonstration, we'll just return the received data
|
|
|
|
return json({
|
|
status: 'success',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
export async function GET({ url }) {
|
|
// Here you could fetch data from a database or another API
|
|
// For demonstration, we'll return a static response
|
|
|
|
const exampleData = {
|
|
message: 'Hello from the API!',
|
|
timestamp: new Date().toISOString()
|
|
};
|
|
|
|
return json(exampleData);
|
|
} |