+ import TopicIndex from './components/topic_index/topic_index.svelte';
+
+ let page;
+ let params;
+
+ // sets the route params and current page.
+
+ const setRoute = function setRoute(targetPage) {
+
+ return function (routerParams) {
+ params = routerParams;
+ page = targetPage;
+ }
+ }
+
+ const router = new LightRouter({
+ routes: {
+ '': () => page = Home,
+ 'f/{id}': setRoute(TopicIndex),
+ 'g/{id}': setRoute(TopicIndex),
+ 'a/{id}': setRoute(Author),
+ 't/{id}': setRoute(Topic),
+ 'p/{id}': setRoute(Post),
+ '.*': setRoute(InvalidRoute)
+ }
+ });
+
+ router.run();