Simple and powerful server that just works so you can focus on your awesome project:
const server = ;// Serve static files from /public on port 3000;// OR serve static files from the root on port 8080;// OR use some simple routes onconst get post = serverrouter;;
After getting Node.js 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 fileconst server = ;const 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!'.
The library documented is here:
Subscribe here to receive tutorials when released. Tutorials are good for learning while the documentation is good for reference/quick use once you know the basics.
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.
I love using my work and I'm available for contractor work. Freelancing helps maintain
server and my other open source projects up to date!