A modern and powerful server for Node.js
A simple, powerful and flexible server for Node.js:
let server = ;// Launch it in port 3000 to serve static files in /public on;// OR serve static files from the project root on;// OR use some simple routes on onlet get post = serverrouter;;
It parses cookies, forms, files, etc automatically with default middlewares while still letting you personalize the options or change those middlewares for others you prefer (or just remove them).
After getting Node ready and
npm init, run this in your project folder to install the server:
npm install server --save
Then you can create a file called
app.js and set the following:
// Include the server in your filelet server = ;let get post = serverrouter;// Initialize the server on port 3000;
Execute this in the terminal to get the server started:
And finally, open your browser on localhost:3000 and you should see your server answered 'Hello world!'.
Everything is documented in detail here:
You can also download the repository and try the examples by browsing to them and
node app.js inside each of them in
Licensed under the MIT License. See
LICENSE for the full license.
This website is NOT running on server.js. It doesn't make sense to run a custom server to display a static website so it's hosted on Github's Pages. From my personal projects I've migrated Comments Network so far to use server.js. You can see it integrated here: