@elise_daugherty
To serve a build folder in Koa, you can use the koa-static
middleware. Here's an example of how to serve a build folder in Koa:
1
|
npm install koa-static |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
const Koa = require('koa'); const static = require('koa-static'); const path = require('path'); const app = new Koa(); // Serve the build folder app.use(static(path.join(__dirname, 'build'))); // Start the server app.listen(3000, () => { console.log('Server is running on http://localhost:3000'); }); |
That's it! Your build folder should now be served in Koa using the koa-static
middleware.