An Express.js-Style router for the front-end
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
custom_theme
docs
lib
test
.babelrc
.codeclimate.yml
.eslintignore
.eslintrc
.gitignore
.travis.yml
LICENSE
README.md
bower.json
frontexpress.js
frontexpress.min.js
frontexpress.min.js.map
gzipsize.js
index.js
mkdocs.yml
package.json
rollup.config.dev.js
rollup.config.prod.js

README.md

frontexpress

An Express.js-Style router for the front-end.

Code the front-end like the back-end. Same language same framework.

frontexpress demo

Build Status Code Climate Coverage Status dependencies Size Shield npm

import frontexpress from 'frontexpress';

// Front-end application
const app = frontexpress();

// handles http 401
app.use((req, res, next)  => {
    if (res.status === 401) {
        window.alert('You are not authenticated! Please sign in.');
    } else {
        next();
    }
});

app.get('/', (req, res) => {
    document.querySelector('.content').innerHTML = 'Hello World!';
});

app.post('/login/:user', (req, res) => {
    document.querySelector('.content').innerHTML = `Welcome ${req.params.user}!`;
});

// start listening front-end requests (emitted/received)
app.listen();

Features

✔️ You already know ExpressJS then you know FrontExpress

✔️ Simple, minimal core extendable through plugins

✔️ Lighweight framework

✔️ Build your front-end application by handling routes

✔️ Ideal for Single Page Application

✔️ Manage ajax requests and browser history

Installation

From npm repository

$ npm install frontexpress

From bower repository

$ bower install frontexpress

From CDN

On jsDelivr

Documentation

Website and Documentation

Tests

Clone the repository:

$ git clone git@github.com:camelaissani/frontexpress.git
$ cd frontexpress

Install the dependencies and run the test suite:

$ npm install
$ npm test

License

MIT