#Sequelize #JavaScript #node

Sequelize Data Types: a practical guide

DataTypes are core to the Sequelize 4 library. This is a practical and complete guide to make up for the sparse Sequelize official documentation on the subject. First of all, DataTypes contains both the types and generators for default values: eg. NOW, UUIDV1 and UUIDV4 are special default values. The places where you’re likely to encounter DataTypes are in the model field definition and in the migration definitions. Note that for a given model and field, the data type should be the same in the model and in the migration. ...

  • Hugo Di Francesco
    Author
3 min read
#meta #seo #technical writing

Technical content workflow for “Code with Hugo”: static site, Paper, Medium, DEV and Buttondown

tl;dr: here are the tools used to power, build and publish codewithhugo.com: Dropbox Paper because it syncs desktop/mobile and outputs to markdown Unsplash for cover images Edited Markdown + images → Hugo static site generator Casper 2 (https://ghost.org default theme) for Hugo Schedule: Newsletter: Mondays 5pm UK every 2 weeks 1+ post a week Cross-post to Medium (Stories → Import a Story) Cross-post to dev.to using RSS feed Social media/promotion < Organic traffic Newsletter powered by https://buttondown. ...

  • Hugo Di Francesco
    Author
7 min read
#JavaScript #meta #payment

Add a client-side paywall using checkoutpage.co and vanilla JavaScript

How I created the buying mechanism for the Sequelize ES6 Cheatsheet using checkoutpage.co and sprinkles of vanilla JavaScript. This strictly isn’t a paywall, it’s all client-side and doesn’t check much. In principle you can display the whole things using a bit of CSS magic. You could also read the source and reverse-engineer what query params work for this page. You could also spoof as Google Bot (or another crawler) and skip the pay overlay. ...

  • Hugo Di Francesco
    Author
11 min read
#sequelize #node #git #cli #JavaScript

Progress and roadblocks: a journey into open-source

Enhancing generators for ES6 in the Sequelize CLI This is the story of my discovery of ES6-class style model definitions with Sequelize (see Using ES6 classes for Sequelize 4 models). The realisation that the current Sequelize CLI model generator didn’t support it (as is expected since it’s not the most common way of doing it). Finally, the impetus to just implement it myself. In other words, I started using a style of Sequelize models that the Sequelize CLI didn’t support. ...

  • Hugo Di Francesco
    Author
6 min read
#meta #deployment #JavaScript

A tiny case study about migrating to Netlify when disaster strikes at GitHub, featuring Cloudflare

Last Monday (22 October 2018) GitHub was going 💥, and scheduled content on Code with Hugo wasn’t going live. For context, the blog’s setup is documented in “Switching the lights on: Hugo vs Hugo config files”. tl;dr (as is relevant to this post) Cloudflare DNS + CDN + proxying + HTTPS GitHub Pages Hugo as a static site generator CircleCI to deploy the site daily + on push (🤷‍♀️wasn’t in the post but that’s how I do it) ...

  • Hugo Di Francesco
    Author
4 min read
#JavaScript #Node #ES6 #architecture

Simple, but not too simple: how using Zeit’s `micro` improves your Node applications

Leave the Express comfort zone to expand how you think about Node application architecture. tl;dr using a function composition model for building HTTP servers is awesome Functions as a Service are great but have some drawbacks micro has a similar, simple API to FaaS but doesn’t have a compilation step micro’s minimalism affects how you solve problems Functions as a composition model for JavaScript Functions as a Service pain points ...

  • Hugo Di Francesco
    Author
7 min read