Last active
September 21, 2021 11:24
-
-
Save amalshaji/742875ad1202936b32c291c3ee652d91 to your computer and use it in GitHub Desktop.
deploy sapper to deta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm run build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { PORT, NODE_ENV } = process.env | |
| const dev = NODE_ENV === 'development' | |
| if (dev) { | |
| express__default['default']() // You can also use Express | |
| .use( | |
| compression__default['default']({ threshold: 0 }), | |
| sirv__default['default']('static', { dev }), | |
| middleware() | |
| ) | |
| .listen(3000) | |
| } else { | |
| const app = express__default['default']() // You can also use Express | |
| .use( | |
| compression__default['default']({ threshold: 0 }), | |
| sirv__default['default']('static', { dev }), | |
| middleware() | |
| ) | |
| module.exports = app | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const app = require('./__sapper__/build/server/server') | |
| module.exports = app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BINARY_CONTENT_TYPES=image/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm uninstall polka | |
| npm install express |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npx degit "sveltejs/sapper-template#rollup" my-app | |
| cd my_app | |
| npm install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sirv from 'sirv' | |
| import express from 'express' | |
| import compression from 'compression' | |
| import * as sapper from '@sapper/server' | |
| const { PORT, NODE_ENV } = process.env | |
| const dev = NODE_ENV === 'development' | |
| if (dev) { | |
| express() // You can also use Express | |
| .use(compression({ threshold: 0 }), sirv('static', { dev }), sapper.middleware()) | |
| .listen(3000) | |
| } else { | |
| const app = express() // You can also use Express | |
| .use(compression({ threshold: 0 }), sirv('static', { dev }), sapper.middleware()) | |
| module.exports = app | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment