A Node.js framework for writing web applications and APIs.
Install PXE.js using NPM or Yarn:
npm i @pxe/server
# or
yarn add @pxe/server
Let's get started with a simple Hello world
application:
const Server = require("@pxe/server");
// Create a web application
const app = new Server();
// Add a middleware. This callback will be called on each request.
app.use(async (ctx) => {
// Set the response body to "Hello world"
ctx.response.body = "Hello world";
});
// Start the server at port 8080 listening for connections.
app.ls(8080);
The above example responses Hello world
on every request to http://localhost:8080.