mirror of
https://github.com/block/goose.git
synced 2026-04-28 11:39:43 +00:00
Some checks failed
Canary / Prepare Version (push) Waiting to run
Canary / build-cli (push) Blocked by required conditions
Canary / Upload Install Script (push) Blocked by required conditions
Canary / bundle-desktop (push) Blocked by required conditions
Canary / bundle-desktop-linux (push) Blocked by required conditions
Canary / bundle-desktop-windows (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
CI / changes (push) Waiting to run
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Lint Rust Code (push) Blocked by required conditions
CI / Check OpenAPI Schema is Up-to-Date (push) Blocked by required conditions
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
Live Provider Tests / check-fork (push) Waiting to run
Live Provider Tests / changes (push) Blocked by required conditions
Live Provider Tests / Build Release Binary (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (push) Blocked by required conditions
Documentation Site Preview / deploy (push) Waiting to run
Publish Docker Image / docker (push) Waiting to run
Deploy Documentation / deploy (push) Has been cancelled
* Add Markdown export of any doc page by appending `.md` to the URL * New "View as Markdown" dropdown menu from the "copy page" button
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Simple static file server for testing markdown exports locally.
|
|
* Unlike `docusaurus serve`, this serves files as-is without routing logic.
|
|
*/
|
|
|
|
const http = require('http');
|
|
const serveStatic = require('serve-static');
|
|
const path = require('path');
|
|
|
|
const buildDir = path.join(__dirname, '..', 'build');
|
|
const port = process.env.PORT || 3001;
|
|
|
|
const serve = serveStatic(buildDir, {
|
|
index: ['index.html'],
|
|
setHeaders: (res, filePath) => {
|
|
// Set proper content type for markdown files
|
|
if (filePath.endsWith('.md')) {
|
|
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
}
|
|
}
|
|
});
|
|
|
|
const server = http.createServer((req, res) => {
|
|
// Handle requests to /goose/ by serving from the build directory
|
|
if (req.url.startsWith('/goose/')) {
|
|
// Strip /goose/ prefix and serve the file
|
|
req.url = req.url.substring(6); // Remove '/goose'
|
|
serve(req, res, () => {
|
|
res.statusCode = 404;
|
|
res.end('Not found');
|
|
});
|
|
} else if (req.url === '/') {
|
|
// Redirect root to /goose/
|
|
res.writeHead(302, { Location: '/goose/' });
|
|
res.end();
|
|
} else {
|
|
// For any other path, return 404
|
|
res.statusCode = 404;
|
|
res.end('Not found - try /goose/');
|
|
}
|
|
});
|
|
|
|
server.listen(port, () => {
|
|
console.log(`\n🚀 Static file server running at http://localhost:${port}`);
|
|
console.log(`\n🏠 Homepage: http://localhost:${port}/goose/`);
|
|
console.log(`\n📝 Test markdown exports:`);
|
|
console.log(` http://localhost:${port}/goose/docs/quickstart.md`);
|
|
console.log(` http://localhost:${port}/goose/docs/getting-started/installation.md\n`);
|
|
});
|