This Val Town service fetches JavaScript or TypeScript files from GitHub repositories or Gists and serves them with the proper content type headers (application/javascript
).
To fetch a file from a GitHub repository:
/github/:owner/:repo/:branch/:path
Example:
/github/microsoft/TypeScript/main/lib/typescript.js
To fetch a file from a GitHub Gist:
/gist/:gistId/:filename
Example:
/gist/a1b2c3d4e5f6g7h8i9j0/example.js
The service automatically sets the appropriate content type header based on the file extension:
.js
, .mjs
, .cjs
: application/javascript
.ts
, .tsx
, .jsx
: application/javascript
(TypeScript files are served as JavaScript).json
: application/json
text/plain