Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {get, post, put, remove} from './requester.js';
- import * as authHandler from './handlers/auth-handler.js';
- import {setHeaderInfo, getPartials} from './shared.js';
- (() => {
- const app = Sammy('#rooter', function () {
- this.use('Handlebars', 'hbs');
- this.get('/', function (ctx) {
- setHeaderInfo(ctx);
- if(ctx.isAuth){
- get('appdata', 'recipes', 'Kinvey')
- .then((recipes) => {
- ctx.recipes = recipes;
- this.loadPartials(getPartials())
- .partial('./views/home.hbs');
- });
- }else{
- this.loadPartials(getPartials())
- .partial('./views/home.hbs');
- }
- });
- this.get('/register', authHandler.getRegister);
- this.post('/register', authHandler.postRegister);
- this.get('/login', authHandler.getLogin);
- this.post('/login', authHandler.postLogin);
- this.get('/logout', authHandler.logout);
- });
- app.run();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement