Skip to content

Commit 1133d2b

Browse files
authored
Create example-runkit.js
1 parent 1b1c91e commit 1133d2b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

example-runkit.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const express = require('express')
2+
const corsProxy = require('@isomorphic-git/cors-proxy/middleware.js')
3+
const service = require('@isomorphic-git/cors-proxy')
4+
5+
const port = 3000
6+
const options = {
7+
origin: '*'
8+
// insecure_origins: ['']
9+
}
10+
11+
const app = express()
12+
app.use(corsProxy(options))
13+
// Alternatively, app.use(service)
14+
15+
app.get('/', (_req, res, _next) => {
16+
res.send('Hello World!')
17+
})
18+
19+
const rkUrl = process.env.RUNKIT_ENDPOINT_URL
20+
console.log(`You can test by running:
21+
$ npx isomorphic-git clone --corsProxy="RUNKIT_ENDPOINT_URL" --url="https://github.com/isomorphic-git/isomorphic-git.git"
22+
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.
23+
You can find out what your endpoint url is by visiting ${rkUrl}
24+
`)
25+
26+
app.listen(port, () => {
27+
console.log(`Example app listening at http://localhost:${port}`)
28+
})

0 commit comments

Comments
 (0)