Skip to content

Instantly share code, notes, and snippets.

sa@mbp: /tmp mkdir akita-react; cd akita-react; npm init -y
Wrote to /private/tmp/akita-react/package.json:
{
"name": "akita-react",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import config from 'sapper/config/rollup.js';
import getPreprocessor from 'svelte-preprocess'
import path from 'path'
import pkg from './package.json';
import postcss from 'rollup-plugin-postcss'
import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
import svelte from 'rollup-plugin-svelte';
@evdama
evdama / server.js
Created July 1, 2019 14:09
current server.js created from sapper template a few weeks ago / switch to polka pending
// @ts-nocheck TODO: remove at some point
//import config from './config';
import express from 'express';
import sirv from 'sirv';
import session from 'express-session';
import bodyParser from 'body-parser';
import * as sapper from '@sapper/server';
import './css/index.css'
@evdama
evdama / _api.js
Created July 1, 2019 14:12
server route unchanged from template
const dev = process.env.NODE_ENV === 'development';
const base = dev ? 'http://localhost:3000' : 'likesports-v2.web.app';
function send({ method, path, data, token }) {
const fetch = process.browser ? window.fetch : require('node-fetch').default;
const opts = { method, headers: {} };
if (data) {
@evdama
evdama / index.ts
Created July 1, 2019 14:16
SSR entry point for Sapper on Firebase
res) => res.send('hello from the SSR function'));
@evdama
evdama / index.ts
Created July 1, 2019 14:18
SSR entrypoint on firebase for Sapper
import * as functions from 'firebase-functions';
//const express = require('express');
// Start writing Firebase Functions
// https://firebase.google.com/docs/functions/typescript
// We have to import the built version of the server middleware.
const { server } = require('../__sapper__/build/server/server');
exports.ssr = functions
.region('us-central1')
// @ts-nocheck TODO: remove at some point
// TODO: what todo with those two imports? needed? if so why and how?
//import config from './config';
//import './css/index.css';
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
@evdama
evdama / server.js
Last active July 2, 2019 16:24
error when uploading sapper project to firebase
// @ts-nocheck TODO: remove at some point
// TODO: what todo with those two imports? needed? if so why and how?
//import config from './config';
//import './css/index.css';
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
@evdama
evdama / server.js
Created July 2, 2019 16:25
error when uploading sapper project to firebase (seems like sirv can't find the static dir?)
// @ts-nocheck TODO: remove at some point
// TODO: what todo with those two imports? needed? if so why and how?
//import config from './config';
//import './css/index.css';
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
{
"name": "functions",
"scripts": {
"build": "tsc",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell"
},