In a serverless project with the serverless framework and TypeScript (or JavaScript), when we have some way of handling dependence packages:

  • Bundled the entry function files to include the content of all related packages.
  • Bundled the entry function files which just include production logic code. But we also pack the node_modules folder with all related packages.
  • Keep node_modules in a layer . Almost the same as the second way. But now, node_modules is not a part of the function code. The function will run on the layer.

In the article, we will not deep drive to explain this topic. Just…

In this article, we will talk about starting a project with Serverless and TypeScript. The article requires basic knowledge about AWS serverless architecture, the Serverless framework, and TypeScript.

We will use the latest stable version of Serverless (2.35.0) to build a “simple” serverless project — A REST API with AWS Lambda function and API gateway.


$ mkdir ts-jest-serverless
$ cd ts-jest-serverless
$ npm install serverless --no-save

Install the serverless package with --no-save option to avoid creating package.json file. In the next part, we will use a template to initiate the project.

Typescript template

This is an easy way…

Now, with TensorFlow.js developers can easily run a machine learning model using JavaScript. With Pre-trained models, you can complete complex tasks easily, it not requires the knowledge to build a model from scratch.

For the first time, TensorFlow.js working as a front-end library for web browsers. But now, tfjs (aka TensorFlow.js) support to be used in backend JavaScript — Nodejs. This means you can create a web service that can work with a TensorFlow model by Nodejs instead of Python.

Follow this example code, we are going to build a web service that includes an API. …

Photo by Safar Safarov on Unsplash.

1. Using TypeScript

This is just my recommendation. I started working with Typescript in 2017, then I become a TypeScript lover. My team members love it too.

The primary benefits of using TypeScript are to catch more errors before they go into production and make it easier to work with your codebase.

TypeScript Benefits:

  • Static Typing — Easy to start if you come from strongly typed languages like C# of Java.
  • A better choice for large coding projects — When you are working in a team, your team should keep the codebase clean and maintainable. When large coding projects have many developers, there…

As you know, jwt tokens are born as a stateless entity. By itself, we can validate a jwt token just by a secret token and its expire time.

However, sometimes our service requires a token to become stateful, which means we can make a jwt token to be invalid in our service.

A particular case is when your service user login to the service, the service will generate a jwt token for the user, and the user can use this token to authenticate for other requests. A user can use their credential (username/password) to get a new jwt token every…

Photo by Bench Accounting on Unsplash.

This is a simple project — Writing an API service running on Nodejs. The service is a URL shortening service. The service also is an example of TDD style using Typescript, Jest, Express, and Mongoose.

Create and initialize the project

This project will be base on TDD with Typescript and Jest: Starter project.

Just clone the starter project from Github:

$ git clone url-shortener
$ cd url-shortener
$ npm ci

With url-shortener is the name of this project. You also can update the project name in package.json file.

"name": "url-shortener",
"version": "1.0.0",
"description": "",
"main": "index.js",

Install required dependencies

First of all, let’s install some…

Photo by Adi Goldstein on Unsplash.

This is the first article to set up a backend project with Typescript end Jest.

It is not a series, but I will release some kind of articles about TDD with Typescript and Jest. This means, “re” write some examples by Typescript and follow TDD style. This article will become first for every article in the same category.

Create and initialize the project

Let’s create a simple nodejs project with this command:

npm init -y

The command will generate package.json file.

Install dependencies for development

We will use Typescript in this project then typescript is the first dependency.

npm install typescript -D

-D option means typescript just use for…

Hoang Dinh

Just A Cat Lover

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