Skip to content

Instantly share code, notes, and snippets.

@enjikaka
Last active September 23, 2017 20:14
Show Gist options
  • Save enjikaka/8134935eea99c3e22b65c884542beb47 to your computer and use it in GitHub Desktop.
Save enjikaka/8134935eea99c3e22b65c884542beb47 to your computer and use it in GitHub Desktop.
'use latest';
import express from 'express';
import compression from 'compression';
const app = express();
if (process.env.NODE_ENV === 'production') {
app.use(compression());
}
app.get('*', (req, res) => {
res.send('Hello world');
});
export default app;
'use latest';
import WT from 'webtask-tools';
import app from './app.mjs';
// export default doesn't work, import above works though
module.exports = WT.fromExpress(app);
{
"name": "bundle-mjs-test",
"version": "1.0.0",
"description": "mjs bundle webtask test",
"main": "bundle-mjs-test.mjs",
"scripts": {
"deploy": "wt create bundle-mjs-test.mjs --bundle --prod"
},
"license": "ISC",
"dependencies": {
"compression": "^1.7.0",
"express": "^4.15.4",
"webtask-tools": "^3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment