Coder Social home page Coder Social logo

js-navigo-webpack-template's Introduction

Js-navigo-webpack-template

What you need

Get started

  1. Install all the modules

npm i

  1. Add your firebase config to the src/database/firebase.js file

The apikey can be found in the settings of your firebase project

https://console.firebase.google.com/u/0/project/{your-project}/settings/general/

The project id is the name of your firebase instance as can be seen on the console when you login.

More information:

https://firebase.google.com/docs/web/setup

  1. Run the starting command

npm run start

  1. To run a compiled build

npm run build

js-navigo-webpack-template's People

Contributors

pixelatex avatar

Watchers

 avatar

js-navigo-webpack-template's Issues

Router parameters

Hi.

Not an issue. Just a question.

How would I access the parameters and query values from within the pages .js files.

`// Only import the compile function from handlebars instead of the entire library
import { compile } from 'handlebars';

// Import the update helper
import update from '../helpers/update';

const { getInstance } = require('../database/firebase');

const firebase = getInstance();
// Import the template to use
const aboutTemplate = require('../templates/list.handlebars');

export default () => {
// Data to be passed to the template
let loading = true;
let posts = {};
const title = 'Firebase calls example';
// Return the compiled template to the router
update(compile(aboutTemplate)({ title, loading, posts }));
// This block will run the firebase code to fetch data
if (firebase) {
const database = firebase.database().ref('/posts');
database.on('value', (snapshot) => {
posts = snapshot.val();
loading = false;
// Run the update helper to update the template
update(compile(aboutTemplate)({ title, loading, posts }));
});
}
};`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.