Node is a run-time environment that makes it possible to write server-side JavaScript. It has gained widespread adoption since its release in 2011. Writing server-side JavaScript can be challenging as a codebase grows due to the nature of the JavaScript language; dynamic and weak typed.
Developers coming to JavaScript from other languages often complain about its lack of strong static typing, but this is where TypeScript comes into the picture β to bridge this gap.
TypeScript is a typed (optional) super-set of JavaScript that can help with building and managing large-scale JavaScript projects. It can be thought of as JavaScript with additional features like strong static typing, compilation, and object-oriented programming.
How we start a new Express and TypeScript project?
The main idea is how to build applications with Express and TypeScript π€ ?
In Kutia we have created a project starter that allows you to have all the right configurations and just start dealing with business logic and not waste time on project configurations π€ͺ.
What are the features of this project starter?
Some of features that project contains are:
Beautiful Code π.
Dependency Injection β€οΈ.
Simplified Database Query π.
Clear Structure with different layers such as controllers, services, repositories, models, middlewares πββοΈ.
Easy Exception Handling π.
Smart Validation βοΈ.
Easy event dispatching π.
Fast Database Building with migrations π.
Easy Data Seeding with our own factories π.
Auth System π.
Docker π³.
Class-based to handle WebSocket events π.
Class-based to handle Cron Jobs πΌ.
API Documentation π.
GraphQL π.
Queue Jobs π§.
How to install the starter project?
You can check all details of a project on GitHub, but to install a project in a short way, you need to: Clone from GitHub, Run npm install and npm run dev.
Now what?
Now you have a project with Scalable structure, Error handling, Authentication, etc.
Also, you are ready to connect your API with cool javascript clients using the latest sexy frameworks.
Original Article
https://kutia.net/build-cool-apis-in-express-and-typescript/
Top comments (0)