Neutrino and Express Preset

220 views Asked by At

I'm using Neutrino as scaffolding tool for Webpack 3.1 and I'm looking for a proper Neutrino preset that combines Express and Webpack so that I see a 'Hello World' website. If someone gives me one proper preset and tells me how to install it, I'll accept this as an answer.

Thank you!

1

There are 1 answers

3
Eli On

This should already be possible with the @neutrinojs/node preset:

// src/index.js

import express from 'express';
import { join } from 'path';

const port = process.env.PORT || 3000;
const app = express();

app.get('/', (request, response) => {
  response.sendFile(join(__dirname, 'index.html'));
});

app.listen(port, () => console.log(`Server running on port ${port}`));