< Previous Article Next Article >

Your Express Server

Express is a flexible web application framework and server. It is one of the most popular frameworks for Node.js, used by millions of developers and integrated into countless applications and other frameworks.

Your Profound.js Space is automatically preconfigured for Express, so you can get a Web application up and running quickly without writing too much code.

The preconfigured server includes features, like hot reloading and database integration, which make developing and deploying Node.js applications easier.

If you don't want to use the preconfigured Express server, you can create your own custom Node.js server. Click here for details.

Express Routes

Each module or file can be turned into an Express route by right-clicking it in the File tree, selecting Properties, and then selecting Express Route.


A basic implementation of an Express route looks like this:

function hello(request, response) {
exports.default = hello;

Stateful apps

You can also configure your Express server to run a stateful application. Stateful apps concentrate on business logic and operate on a higher level that doesn't directly deal with requests and response object.

To create a stateful app, right-click your Node.js file, select Properties, and then select the App Start File checkbox, without selecting Express Route. For more information about developing stateful apps, click here.

Managing your server

Your server starts automatically when you launch your application. It may also go to sleep after a certain amount of inactivity.

When necessary, you can view server logs or restart your server from the Server menu:


But keep in mind that changes to your code go live immediately, so there is no need to manually restart your server when application changes are made.

Installing npm packages

Node.js applications often rely on external packages from npm, the world's largest software registry of reusable packages. You can quickly install an npm packages by using the Install npm Packages menu option on the Server Menu.

Alternatively, you can add the packages manually by modifying the package.json file in your space. To see pacakge.json, you must first enable the Show Hidden radio button on the Files tree.


To use an npm package in your Node.js code, pass the package name as an argument to the Node.js require() API.

const fraction = require("num2fraction");
let ratio = fraction(students / instructors);


Have questions about this topic? Ask for help on our Profound.js Spaces Discussion Forum.

< Previous Article Next Article >