Skip to content

Instantly share code, notes, and snippets.

@ssinno28
ssinno28 / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ssinno28
ssinno28 / robots.txt.js
Created October 19, 2023 20:39
Nuxt/Nitro Dynamic Robots.txt Server Route
import { defineEventHandler } from 'h3';
// file route should be server/routes/robots.txt.js
export default defineEventHandler(async (event) => {
const runtimeConfig = useRuntimeConfig();
console.log(runtimeConfig.public.siteUrl);
let url = `${runtimeConfig.public.siteUrl}/robots.dev.txt`;
if (runtimeConfig.public.siteUrl === 'https://www.yourprodsite.com/') {