forked from billiegoose/cors-buster
-
Notifications
You must be signed in to change notification settings - Fork 35
/
example-runkit.js
31 lines (25 loc) · 1.02 KB
/
example-runkit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const express = require('express')
const corsProxy = require('@isomorphic-git/cors-proxy/middleware.js')
const service = require('@isomorphic-git/cors-proxy')
const port = 3000
const options = {
origin: '*'
// insecure_origins: ['']
}
const app = express()
app.use(corsProxy(options))
// Alternatively, app.use(service)
app.get('/', (_req, res, _next) => {
res.send('Hello World!')
})
const rkUrl = process.env.RUNKIT_ENDPOINT_URL
console.log(`You can test by running:
$ npx isomorphic-git clone --corsProxy="RUNKIT_ENDPOINT_URL" --url="https://github.com/isomorphic-git/isomorphic-git.git"
Redirects are not supported, so you'll need the root endpoint url... not the one that ends with a path and starts with runkit.io, but the one that ends with runkit.sh.
You can find out what your endpoint url is by visiting ${rkUrl}
It should look something like "https://untitled-123abc.runkit.sh"
DO NOT add a forward slash at the end!
`)
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})