Skip to content

Commit

Permalink
🔀 Intégration des dernières modifications de la version 3.14 (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPavon authored Nov 17, 2023
2 parents 4fdc3a7 + 874e5d3 commit 725aff1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ REDIS_URL=redis://:localpwd@localhost:6379
TRACKER_WEBSITE_ID=
CRISP_WEBSITE_ID=

# Next
NEXT_APP_ACTIVATED=true

# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=fake-secret
Expand Down
2 changes: 1 addition & 1 deletion src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class routes {
static ABONNEMENT_LETTRE_INFORMATION = '/abonnement-lettre-information.html';
static POST_SINSCRIRE_LETTRE_INFORMATION = '/s-inscrire-a-la-lettre-d-information';
static DECLARATION_ACCESSIBILITE = '/accessibilite.html';
static LOGOUT_ACTION = '/auth/signOut';
static LOGOUT_ACTION = process.env.NEXT_APP_ACTIVATED === 'true' ? '/auth/signOut' : '/logout';
static SIGNUP = '/signup.html';
static POST_SIGNUP = '/signup';

Expand Down
27 changes: 15 additions & 12 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,25 @@ export async function makeServer(port: number, sessionSecret: string) {
});

/////// Custom server next
const nextApp = next({
dev: false,
dir: join(__dirname, isLocalEnv ? '../' : '../..', 'packages', 'applications', 'ssr'),
});
if (process.env.NEXT_APP_ACTIVATED === 'true') {
const nextApp = next({
dev: false,
dir: join(__dirname, isLocalEnv ? '../' : '../..', 'packages', 'applications', 'ssr'),
});

const nextHandler = nextApp.getRequestHandler();
const nextHandler = nextApp.getRequestHandler();

app.get('*', (req, res) => {
return nextHandler(req, res);
});
app.get('*', (req, res) => {
return nextHandler(req, res);
});

app.post('*', (req, res) => {
return nextHandler(req, res);
});
app.post('*', (req, res) => {
return nextHandler(req, res);
});

await nextApp.prepare();
}

await nextApp.prepare();
await bootstrap();
app.listen(port, () => {
process.env.start_datetime = new Date().getTime().toString();
Expand Down

0 comments on commit 725aff1

Please sign in to comment.