Skip to content

Commit 65e7d34

Browse files
authored
Merge pull request #13 from FossPrime/patch-2
Add runkitExample metadata
2 parents 4c441a9 + 22e2721 commit 65e7d34

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

example-runkit.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
It should look something like "https://untitled-123abc.runkit.sh"
26+
DO NOT add a forward slash at the end!
27+
`)
28+
29+
app.listen(port, () => {
30+
console.log(`Example app listening at http://localhost:${port}`)
31+
})

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@
3535
},
3636
"publishConfig": {
3737
"access": "public"
38-
}
38+
},
39+
"runkitExampleFilename": "example-runkit.js"
3940
}

0 commit comments

Comments
 (0)