Skip to content

Commit

Permalink
Merge pull request #4 from Ponjimon/sn/server-file
Browse files Browse the repository at this point in the history
build: convert to server.ts file
  • Loading branch information
Ponjimon committed May 14, 2022
2 parents ac7f0ef + cd9ec49 commit 5efa7f0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
/.cache
/build
/public/build
/functions/\[\[path\]\].js*
12 changes: 0 additions & 12 deletions functions/[[path]].ts

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"license": "MIT",
"scripts": {
"prepare": "husky install",
"build": "cross-env NODE_ENV=production remix build",
"dev": "cross-env NODE_ENV=development run-p dev:*",
"build": "remix build",
"dev": "remix build && run-p dev:*",
"dev:remix": "remix watch",
"dev:wrangler": "wrangler pages dev --local ./public",
"start": "yarn run dev:wrangler"
"dev:wrangler": "cross-env NODE_ENV=development wrangler pages dev --local ./public",
"start": "cross-env NODE_ENV=production yarn run dev:wrangler"
},
"dependencies": {
"@remix-run/cloudflare": "^1.4.3",
Expand Down
7 changes: 2 additions & 5 deletions remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
* @type {import('@remix-run/dev/config').AppConfig}
*/
module.exports = {
appDirectory: 'app',
assetsBuildDirectory: 'public/build',
publicPath: '/build/',
serverBuildPath: 'build/index.js',
serverBuildTarget: 'cloudflare-pages',
server: './server.js',
devServerBroadcastDelay: 1000,
ignoredRouteFiles: ['.*'],
ignoredRouteFiles: ['**/.*'],
};
11 changes: 11 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createPagesFunctionHandler } from '@remix-run/cloudflare-pages';
import * as build from '@remix-run/dev/server-build';

const handleRequest = createPagesFunctionHandler({
build,
mode: process.env.NODE_ENV,
});

export function onRequest(ctx: EventContext<any, any, any>) {
return handleRequest(ctx);
}

0 comments on commit 5efa7f0

Please sign in to comment.