Build Cool APIs In Express and TypeScript
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.