Quickpage is a GitHub template for creating single-page-application with front-end routing and JSX. See demo at official page https://quickpage.foxdebug.com.
Create github repository using this template.
To start the server run the following bash command
: yarn start
To start the dev-server run the following bash command
: yarn start-dev
: yarn build-release
The server uses 'NodeJs' and 'ExpressJs' for serving files. You can edit the server src code in server
directory.
import Router from 'lib/Router';
Add routes.
Router.add('/home', (params, queries) => {
// render home
});
Start route.
Router.listen();
Create a router page
touch adminRouter.js
Initialize router page.
// adminRouter.js
import Router from 'lib/RouterExtension';
const router = new Router('/admin');
// routes
export default router;
Add middle function to filter routes.
Router.beforeNavigate((url, next) => {
// url -> current url
// next -> callback function
// call next function to proceed
});
Add a route.
Router.add('home', (params, queries) => {
// render '/base-route/home'
});
Add router to main Router.
import adminRouter from './adminRouter';
import Router from 'lib/Router';
Router.use(adminRouter);
Router.listen();