hchiam / sourcefetch-server

A server to seek a code snippet for you. Inspired by Atom plugin Sourcerer. https://codepen.io/hchiam/full/PEMgBN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sourcefetch-server version Build Status

Live demo: https://codepen.io/hchiam/full/PEMgBN

Just one of the things I'm learning. https://github.com/hchiam/learning

Setup:

git clone https://github.com/hchiam/sourcefetch-server.git
cd sourcefetch-server
npm install
node test.js

Originally intended for use within my LUI demo here.

Server: https://sourcefetch-server.glitch.me

Code: https://glitch.com/edit/#!/sourcefetch-server?path=server.js:1:0

Inspired by: https://github.com/hchiam/sourcefetch-tutorial (specifically sourcefetch.js and package.json)

SVN at: https://github.com/hchiam/sourcefetch-server

A helpful note on a lesson learned with combining async/await with .map

https://stackoverflow.com/questions/40140149/use-async-await-with-array-map/40140562#40140562

Problem: If you give await an object that isn't a Promise (like what .map returns), then it'll evaluate immediately instead of actually waiting.

Solution: Wrap the .map in Promise.all, like this: await Promise.all(arr.map(async x => await someProcessing(x)))

About

A server to seek a code snippet for you. Inspired by Atom plugin Sourcerer. https://codepen.io/hchiam/full/PEMgBN

License:MIT License


Languages

Language:JavaScript 98.2%Language:HTML 1.1%Language:Sass 0.6%Language:CSS 0.1%