Quickpage is a GitHub template for creating single-page-application with front-end routing. 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.
Create a router.
import Router from 'lib/Router';
const router = new 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';
const router = new Router();
router.use(adminRouter);
router.listen();