Create folder with...
server.js
const http = require('http')
const server = http.createServer((req, res) => {| { | |
| "$schema": "https://zed.dev/schema/themes/v0.2.0.json", | |
| "author": "Spacegray (ported to Zed)", | |
| "name": "Spacegray", | |
| "themes": [ | |
| { | |
| "name": "Spacegray", | |
| "appearance": "dark", | |
| "style": { | |
| "background": "#2b303bff", |
| var createError = require('http-errors') | |
| var express = require('express') | |
| var path = require('path') | |
| var cookieParser = require('cookie-parser') | |
| var logger = require('morgan') | |
| var getMsgs = require('./routes/get') | |
| var setMsgs = require('./routes/set') | |
| var app = express() |
| import { Main } from "./templates/main.mjs" | |
| let state = { counter: 0 } | |
| const render = () => (document.body.innerHTML = Main({ state })) | |
| const reducer = (e) => { | |
| const { action } = e.target.dataset | |
| const actions = { |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>GraphQL</title> | |
| </head> | |
| <pre></pre> |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>3D Carousel</title> | |
| <link rel="stylesheet" href="style.css" /> | |
| <!-- Inspiration from: https://codepen.io/dudleystorey/pen/DvZjLz --> | |
| <style> | |
| /* 360 / num of pictures. e.g. 360 / 10 = 36deg */ |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>HTMX Demo</title> | |
| </head> | |
| <body> | |
| <button hx-get="/unauthed" hx-swap="outerHTML">unauthed test</button> |
| import prompts from 'prompts' | |
| const grid = [0, 0, 0, 0, 0, 0, 0, 0, 0] | |
| /** | |
| * Semantic wrapper for console.log | |
| */ | |
| const render = (val) => console.log(val) | |
| /** |
| import { verify } from 'utils' | |
| import _create from 'api/app/create' | |
| import _read from 'api/app/read' | |
| import _update from 'api/app/update' | |
| import _delete from 'api/app/delete' | |
| // e.g. /some/endpoint | |
| const ApiApp = async (req, res) => { | |
| const auth = await verify(req.headers.authorization) | |
| if (!auth.success) { |
| // fixed version of https://javascript.plainenglish.io/introduction-to-redis-and-caching-with-node-js-using-upstash-88efbe39eea2 | |
| import express from 'express' | |
| import mongoose from 'mongoose' | |
| import bodyParser from 'body-parser' | |
| import { createClient } from 'redis' | |
| import { v4 as uuidv4 } from 'uuid' |