https://github.com/camelaissani/frontexpress
An Express.js-Style router for the front-end
https://github.com/camelaissani/frontexpress
browser expressjs front-end history javascript middleware navigation router spa spa-application url url-parsing
Last synced: about 1 year ago
JSON representation
An Express.js-Style router for the front-end
- Host: GitHub
- URL: https://github.com/camelaissani/frontexpress
- Owner: camelaissani
- License: mit
- Created: 2016-06-26T09:34:44.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-04T19:28:06.000Z (almost 9 years ago)
- Last Synced: 2024-05-14T00:34:42.895Z (about 2 years ago)
- Topics: browser, expressjs, front-end, history, javascript, middleware, navigation, router, spa, spa-application, url, url-parsing
- Language: JavaScript
- Homepage: https://frontexpressjs.com
- Size: 257 KB
- Stars: 259
- Watchers: 9
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://frontexpressjs.com)
An Express.js-Style router for the front-end.
Code the front-end like the back-end. Same language same framework.
[frontexpress demo](https://github.com/camelaissani/frontexpress-demo)
[](https://travis-ci.org/camelaissani/frontexpress)
[](https://codeclimate.com/github/camelaissani/frontexpress)
[](https://coveralls.io/github/camelaissani/frontexpress?branch=master)


[](https://www.npmjs.com/package/frontexpress)
```js
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](http://expressjs.com/) 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
```bash
$ npm install frontexpress
```
#### From bower repository
```bash
$ bower install frontexpress
```
#### From CDN
On [jsDelivr](https://cdn.jsdelivr.net/npm/frontexpress@latest/frontexpress.min.js)
## Documentation
[Website and Documentation](https://frontexpressjs.com)
## Tests
Clone the repository:
```bash
$ git clone git@github.com:camelaissani/frontexpress.git
$ cd frontexpress
```
Install the dependencies and run the test suite:
```bash
$ npm install
$ npm test
```
## License
[MIT](LICENSE)