Skip to main content

Command Palette

Search for a command to run...

XpresserJs, First post on Hashnode.

Published
โ€ข2 min read
XpresserJs, First post on Hashnode.

Hey There, ๐Ÿ‘‹

So we have decided to host the blog version of the xpresserjs framework on hashnode.com. We were a few days away from creating our own markdown supported blog from scratch before we learned about hashnode and so far it feels like home. ๐Ÿ˜‰

What is XpresserJs

XpresserJs is a server-side and command-line framework for Nodejs built using express as it's server.

Visit the official documentation to learn more about XpresserJs

A few lines about xpresserjs

Create file server.js

// Import Xpresser
const xpresser = require("xpresser")

// Initialize with your configuration.
const $ = xpresser.init({
     env: process.env.NODE_ENV,
     name: "My First Xpresser Project"
     paths: {
          base: __dirname,
          routesFile: "routes.js",
     }
})

// Boot Xpresser
$.boot();

With these few lines of code, you have a full MVC framework waiting for you to start building.

Run node server.js and you should see a beautiful 404 error page. This is because no routes have been added.

Adding routes

create file routes.js

const {getInstanceRouter} = require("xpresser");
const router = getInstanceRouter();

router.get('/', () => "Hello World");
router.get('/about', http => http.send({
     url: http.req.url
}));

Re-run node server.js and visit / and /about

More from this blog

XpresserJs Framework

2 posts

Official Blog for Xpresserjs Nodejs Framework