███████╗███╗ ███╗
██╔════╝████╗ ████║
█████╗ ██╔████╔██║
██╔══╝ ██║╚██╔╝██║
██║ ██║ ╚═╝ ██║
╚═╝ ╚═╝ ╚═╝
"Building simplicity and efficiency, one route at a time – meet your compact HTTP framework for Node.js"
Server Setup
//*server.js*//
Server(3000, 5, (port) => {
console.log('Proxy listening at http://localhost:' + port)
}, (port) => {
console.log('Server listening at http://localhost:' + port)
})
- PORT: Sets up a proxy server at the given port.
- noOfServers: Distributes incoming requests across multiple internal server instances.
Adding Routes
//*routes.js*//
fm.addRoute('/', (req, res, app) => {
app.send('index.html')
})
fm.addRoute('/submit', (req, res, app) => {
res.write('ok!')
res.end()
})
Simple and decent routing using a handler function with req, res, and app objects.
Dynamic Data
//*dynamic.js*//
fm.addRoute('/user', (req, res, app) => {
app.send('profile.fm', 'fm', {
'name': 'Tiru',
'skills': ['Node.js', 'Scaling', 'Logic']
})
})
The .fm extension allows seamless injection of JSON data into your HTML templates.
Quick Start
//*main.js*//
import fm from "./dotFM/dotFM.js";
fm.addRoute('/', (req, res, app) => {
app.send('index.html')
})
fm.addRoute('/submit', (req, res, app) => {
res.write('Success')
res.end()
})
fm.Server(4000, 5)