Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions templates/eject-esm/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import closeWithGrace from 'close-with-grace'
// Import your application
import appService from './app.js'

// Dotenv config
// Read and load environment variables from .env files (ignore if not present)
try {
process.loadEnvFile()
} catch {}
Expand All @@ -17,7 +17,7 @@ const app = Fastify({
logger: true
})

// Register your application as a normal plugin.
// Register your application as a normal plugin
app.register(appService)

// delay is the number of milliseconds for the graceful close to finish
Expand All @@ -28,7 +28,7 @@ closeWithGrace({ delay: process.env.FASTIFY_CLOSE_GRACE_DELAY || 500 }, async fu
await app.close()
})

// Start listening.
// Start listening
app.listen({ port: process.env.PORT || 3000 }, (err) => {
if (err) {
app.log.error(err)
Expand Down
6 changes: 4 additions & 2 deletions templates/eject-ts/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Fastify from 'fastify'

// Require library to exit fastify process, gracefully (if possible)
import closeWithGrace from 'close-with-grace'

// Read and load environment variables from .env files (ignore if not present)
try {
process.loadEnvFile()
} catch {}
Expand All @@ -12,7 +14,7 @@ const app = Fastify({
logger: true,
})

// Register your application as a normal plugin.
// Register your application as a normal plugin
app.register(import('./app'))

// delay is the number of milliseconds for the graceful close to finish
Expand All @@ -23,7 +25,7 @@ closeWithGrace({ delay: parseInt(process.env.FASTIFY_CLOSE_GRACE_DELAY) || 500 }
await app.close()
} as closeWithGrace.CloseWithGraceAsyncCallback)

// Start listening.
// Start listening
app.listen({ port: parseInt(process.env.PORT) || 3000 }, (err: any) => {
if (err) {
app.log.error(err)
Expand Down
6 changes: 3 additions & 3 deletions templates/eject/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

// Read the .env file.
// Read and load environment variables from .env files (ignore if not present)
try {
process.loadEnvFile()
} catch {}
Expand All @@ -16,7 +16,7 @@ const app = Fastify({
logger: true
})

// Register your application as a normal plugin.
// Register your application as a normal plugin
const appService = require('./app.js')
app.register(appService)

Expand All @@ -28,7 +28,7 @@ closeWithGrace({ delay: process.env.FASTIFY_CLOSE_GRACE_DELAY || 500 }, async fu
await app.close()
})

// Start listening.
// Start listening
app.listen({ port: process.env.PORT || 3000 }, (err) => {
if (err) {
app.log.error(err)
Expand Down