forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1export default defineEventHandler(event => {
2 const url = getRequestURL(event)
3 const origin = url.origin
4
5 setHeader(event, 'Content-Type', 'application/opensearchdescription+xml')
6
7 return `
8<?xml version="1.0" encoding="UTF-8"?>
9<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
10 <ShortName>npm</ShortName>
11 <Description>Search npm packages on npmx.dev</Description>
12 <InputEncoding>UTF-8</InputEncoding>
13 <Image width="16" height="16" type="image/svg+xml">${origin}/favicon.svg</Image>
14 <Url type="text/html" template="${origin}/search?q={searchTerms}"/>
15 <Url type="application/x-suggestions+json" template="${origin}/api/opensearch/suggestions?q={searchTerms}"/>
16 <Url type="application/opensearchdescription+xml" rel="self" template="${origin}/opensearch.xml"/>
17</OpenSearchDescription>
18 `.trim()
19})