Skip to content

Commit

Permalink
fix: miniflare dev script (#137)
Browse files Browse the repository at this point in the history
It wasnt starting the http server.
  • Loading branch information
hugomrdias authored Nov 7, 2022
1 parent dc951a4 commit f2cffb2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/access-api/scripts/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { fileURLToPath } from 'url'
import { build } from 'esbuild'
import Sentry from '@sentry/cli'
import { createRequire } from 'module'
import { Miniflare } from 'miniflare'
import { Log, LogLevel, Miniflare } from 'miniflare'

// @ts-ignore
import git from 'git-rev-sync'
Expand Down Expand Up @@ -116,10 +116,14 @@ prog
modules: true,
watch: true,
envPath: path.resolve(__dirname, '../../../.env'),
log: new Log(LogLevel.DEBUG), // Enable --debug messages
})

const binds = await mf.getBindings()
const db = /** @type {D1Database} */ (binds.__D1_BETA__)
await migrate(db)
const server = await mf.createServer() // Create http.Server instance
server.listen(8787, async () => {
const binds = await mf.getBindings()
const db = /** @type {D1Database} */ (binds.__D1_BETA__)
await migrate(db)
})
})
prog.parse(process.argv)

0 comments on commit f2cffb2

Please sign in to comment.