#docker #node #docker-compose #deploymentDocker Compose Local HTTPS with nginx or Caddy and mkcertA solution to serve your Dockerized application on Docker Compose with TLS/SSL locally by leveraging a HTTPS reverse-proxy and mkcert. Examples with Caddy and nginx are at: github.com/HugoDF/docker-compose-local-https Table of contents: ...
#deployment #node #javascript #tooling #netlify #dokkuDeployment options: Netlify + Dokku on DigitalOcean or Hetzner Cloud vs now.sh, GitHub Pages, Heroku and AWSSettling on a Netlify + Dokku on DigitalOcean (for US) or Hetzner Cloud (for EU) deployment stack for JavaScript and Node. Over the last few years I’ve never quite settled on a goto deployment strategy for my apps and projects. Technology-wise it has settled towards Vue or stati ...
#node #ava #Testing #javascriptJavaScript Object.defineProperty for a function: create mock object instances in Jest or AVAThis post goes through how to use Object.defineProperty to mock how constructors create methods, ie. non-enumerable properties that are functions. The gist of Object.defineProperty use with a function value boils down to: const obj = {} Object.defineProperty(obj, 'yes', { ...
#git #bashFix git “tip of your current branch is behind its remote counterpart” - 4 real-world solutionsWhen working with git a selection of GitLab, GitHub, BitBucket and rebase-trigger-happy colleagues/collaborators, it’s a rite of passage to see a message like the following: Pushing to [email protected]:some-project/some-repo.git To [email protected]:some-project/some-repo.git ! [rejec ...
#javascript #fetchPass cookies with axios or fetch requestsWhen sending requests from client-side JavaScript, by default cookies are not passed. By default, fetch won’t send or receive any cookies from the server, resulting in unauthenticated requests https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch Two JavaSc ...
#Express #node #jest #Testing #javascriptA testing guide for Express with request and response mocking/stubbing using Jest or sinonTo test an Express handler, it’s useful to know how to successfully mock/stub the request and response objects. The following examples will be written both using Jest and sinon (running in AVA). The rationale for this is the following. Jest is a very popular “all-in-one” testing ...
#Express #node #javascript #deploymentNode.js configuration management without config or dotenvThe config npm package is great (npmjs.com/package/config), but it encourages confusing and non-12-factor-app-compliant patterns. We’ll look at some of the patterns it encourages and why they’ll bring you struggles down the road as well a simple, single-file, no-dependency way to ...
#bash #deployment #ci #toolingBash Cheatsheet: check if environment variables are set or file/symlinks exists + moreA bash scripting cheat sheet for developers who just want to get by. Writing setup, CI and deployment flows means a bit of the old bash scripting. Despite my deep interest in the intricacies of Bash (/sarcasm), I’ve kept hitting up Google and StackOverflow for solutions to ...
#javascript #nodeAsync JavaScript: history, patterns and gotchasA look at the history, patterns and gotchas of asynchronous operations in JavaScript. We’ll go through the pros and cons of callbacks, Promises and async/await. Present some pitfalls to bear in mind as well as introducing how you would deal with certain situations. Live-cod ...
#deployment #dokku #MongoDBConnect to MongoDB on Dokku with your local command line or Robo3TThe Dokku mongo plugin provides a mongo:connect command, which opens a tunnelled connection to you MongoDB instance on Dokku. This is how you can connect to your database using the tool of your choice, the examples will be using Robo3T. Table of Contents: ...