mathiuskormasela12 /
belajar-express-ts
Belajar Membangun Rest Api Dengan Menggunakan Express, Typescript & Sequelize
27/100 healthLoading repository data…
pristya / repository
Membangun REST API Server dengan Node.js & TypeScript Ini adalah repository pendamping belajar yang berisi implementasi dan contoh kode untuk membangun Web Backend REST API yang cepat dan terstruktur menggunakan framework NAIV, berjalan di Node.js dengan bahasa TypeScript dan ORM TypeORM.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Install Naiv Developer Tools on your VSCode or VSCodium
Before start writing API program:
Take a look at our design example on design folder, it is simple and self-explain format.
Click Open Editor to modify the design or create a new file with extension .naiv on the same folder. All the design files inside design folder are connected and can cross-reference to each other.
After design process, compile the design into typescript language:
npm run codegen
it will create a new folder types with all generated typescript files. You should not modify the files since it will be regenerated later if you change the data or API design.
On the API design you can see alias key followed by a function-like name, look at a simple api design below
api get /my-course {
alias getMyCourse
headers {
authorization string required
}
query {
limit number
offset number
q string
}
return {
total number required
data table.Course required
} required
}
The design will be compiled into a typescript types with name:
type T_getMyCourse
combination of T_ + getMyCourse, same pattern apply for other API alias name.
Now you can implement a function for the API on the file implementation/getMyCourse.ts like below:
// implementation/getMyCourse.ts
import { T_getMyCourse } from "../types/api/getMyCourse";
export const getMyCourse: T_getMyCourse = async req => {
//
}
You should place the function name inside folder implementation with exactly same file name with alias API name and also same for the export const name, otherwise the server will not recognize your API implementation.
Before running the server, make sure you already have configure you database connection correctly. Look at the Database Migration Guide for db configuration.
npm run build && npm start
The server will automatically put your implementation function as controller/logic process on each API endpoint.
Before running db migration, you need to setup your database credential on .env file, duplicate from .env.example if it doesnt exist.
npm run generate-migration migration/<Migration-File-Name>
This is an auto-generated migration provided by TypeORM, migration script will be automatically created on the folder migration. For more information please see TypeORM migration guide.
After generating migration script file, run the migration to apply the changes to database
npm run migrate
You can copy the sample .env.example to .env.
On the .env file
On the .env file
You can modify index.ts and access the ExpressJS instance from server variable.
const server = new Server();
server.express?.use(...); // <-- access ExpressJS instance
Selected from shared topics, language and repository description—not editorial ratings.
mathiuskormasela12 /
Belajar Membangun Rest Api Dengan Menggunakan Express, Typescript & Sequelize
27/100 healthPitokDf /
Template backend siap pakai menggunakan Express.js, TypeScript, dan Prisma ORM. Cocok untuk membangun REST API modern, aman, dan scalable.
40/100 healthjakaprayudha /
express-trpc adalah boilerplate backend yang mengintegrasikan Express.js dengan tRPC untuk membangun API end-to-end type-safe tanpa REST schema atau GraphQL. Cocok untuk pengembangan backend TypeScript yang cepat, konsisten, dan minim boilerplate, dengan fokus pada kontrak API berbasis tipe.
jakaprayudha /
hono-trpc adalah boilerplate backend yang menggabungkan Hono sebagai web framework ultra-fast dengan tRPC untuk membangun API end-to-end type-safe tanpa REST atau GraphQL schema. Dirancang untuk runtime modern (Node, Bun, Deno, Edge) dengan performa tinggi, DX optimal, dan kontrak API berbasis TypeScript.
34/100 health