Skip to content

Instantly share code, notes, and snippets.

View a9kit's full-sized avatar

Ankit Kumar a9kit

View GitHub Profile
const express = require('express')
const app = express()app.use(express.static('./build'));app.listen(process.config.PORT, function () {
});
{
"short_name": "PWA in Cosmic JS",
"name": "Progressive Web App in React & Cosmic JS",
"icons": [
{
"src": "chrome-touch-icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
import config from './../config/config';
import axios from 'axios';
const newsData = {
// add news to Cosmic JS database
addnews(title, description, newsbody, date)
{
return axios.post(config.url+config.bucket_slug+"/add-object/", {
title: title, slug: title, content: newsbody, type_slug: 'news', write_key: config.write_key,
import config from './../config/config';
import axios from 'axios';
const authentication = {
login(email)
{
return axios.get(config.url+config.bucket_slug+"/object-type/admins/search",{
params:{
metafield_key: 'email',
@a9kit
a9kit / app.json
Created January 1, 2019 19:27
additions in app.json
{
"scripts": {
"dokku": {
"predeploy": "node prepare.js && ng build --aot --prod"
}
}
}
@a9kit
a9kit / app.js
Created January 1, 2019 19:25
add code to app.js
const express = require('express')
const app = express()app.use(express.static('./dist'));app.listen(process.config.PORT, function () {
});
@a9kit
a9kit / package.json
Created January 1, 2019 19:22
package.json file modifications
{
...
"scripts": {
...
"start": "node app.js"
},
...
"engines": {
"node": "6.9.4",
"npm": "4.2.0"