Deploy your node application using netlfiy functions

AWS’s serverless Lambda functions open a world of possibilities for running on-demand, server-side code without having to run a dedicated server.

Netlify lets you deploy serverless Lambda functions without an AWS account, and with function management handled directly within Netlify. Your serverless functions are version-controlled, built, and deployed along with the rest of your Netlify site, and we will automatically handle service discovery through our built-in API gateway. This eliminates overhead and brings the power of Deploy Previews and rollbacks to your serverless functions.

We will run through how to deploy a ‘Hello…


Create a laravel 8 app with basic authentication

Photo by Pierre Châtel-Innocenti on Unsplash

Laravel 8 has removed default auth scaffolding and simply provides a composer package for creating auth scaffold in a Laravel application. This article will show how to get a basic authentication system up and running with the laravel/ui package.

Create a new project

composer create-project --prefer-dist laravel/laravel laravel_demo

For more detailed installation instructions, visit the documentation.

Database configuration

You can set up a database like mysql by modifying the .envfile:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db name
DB_USERNAME=db user name
DB_PASSWORD=db password

Or you can set up sqlite:

  • Create file called database.sqlite in this folder as database/database.sqlite
  • Modify the .env file like this:
DB_CONNECTION=sqlite

Note:

  • sqlite database doesn’t…


Log users in when running tests using Laravel Passport

Photo by Jess Bailey on Unsplash

Writing tests is always important to maintain the quality of your codebase. Most Laravel APIs will have authenticated routes, which only logged-in users can access or users with certain roles etc. To write tests for these routes you will need to mock logins in your test. I will show how you can achieve this with minimal fuss.

You need to sign in a different user for each test, so before each request, you send you could create a user and sign them in, but it will get very repetitive if you have any more than a few tests in your…


Upload & download metadata with AWS S3 Buckets

Photo by DocuSign on Unsplash

Thanks to the Storage Facade in Laravel, interacting with files is now a lot more straightforward. In past implementations of file upload, I sent the file to the same server as my Laravel API, in order to upload it to S3. That worked out ok, you can upload the file like this:

$file->storeAs($basePath, $uuid . '.' . $file->extension(), 's3');

This worked quite well for small files — I just kept a database table of file_uploads to store where each file was now located within S3.

Now I have a new situation where the file is coming from another server, and…


use tailwind in react project!

Introduction

Tailwindcss is a utility-first CSS framework that can be composed to build any design, directly in your markup.

This is a quick tutorial to show how tailwind can be configured in a fresh React application using create react app.

Creating a new React application

Create a new react application:

npx create-react-app tailwind-demo
cd tailwind-demo

When I run yarn start and visit the default url localhost:3000 I can see the familiar React page:


How pet microchipping works

MyPet — microchip database and veterinary software

At MyPet, we believe that getting your pet microchipped is the best way of making sure you’re reunited if they get lost or stolen. All pets should be microchipped — a collar or tag can fall off or be removed, but a microchip is a more permanent way to identify your pet and keep them safe.


CODEX

Make a human-readable identifier for users on a ‘per team’ basis

Photo by Eric Krull on Unsplash

Problem

I have an application which has a table of users and a new requirement that these users have an incrementing identifier applied both for new users and existing users. I want to show how to achieve the database migration that needs to be written to retrospectively apply this identifier to existing users in the order that the users were created.

I want to add a unique identifier to my table which counts a user’s ‘number’ within a team retrospectively.

My users table:

The identifier column is the new column and I’d like to add. The first user in each…


What webhooks are, how webhooks work, and when to use them

Photo by Susan Yin on Unsplash

More and more companies are beginning to use Webhook technology in software integration, while interest in webhooks has grown considerably over the past 10 years according to Google Trends:


CODEX

Generate a “Hello world” larvel package in record time!

Photo by Oscar Sutton on Unsplash

Packages are the primary way of adding functionality to Laravel. This article will get you up and running quickly with a basic package.

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage them for you. For this tutorial you will need to have composer installed as a prerequisite. You can download composer here.

Create a new laravel project:

composer create-project — prefer-dist laravel/laravel documentrcd documentr

Open the project in your IDE.

Create the folder structure

The first thing to…


Improve tests for your laravel application

Photo by Jack B on Unsplash

Introduction

PHPUnit is a unit testing framework for the PHP programming language. Laravel has support for PHPUnit included out of the box, and a phpunit.xml file is already set up for your application.

In your project your tests directory will contain 2 directories: Feature and Unit. Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method. …

Paul Reaney

I am a software developer and I like to write about interesting things I come across in my day to day.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store