Nest.js
Bootstrap Remult in the Nest.js back-end
- Create a
main.tsfile in thesrc/folder with the following code:
ts
// src/main.ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { remultApi } from 'remult/remult-express'
async function bootstrap() {
const app = await NestFactory.create(AppModule)
app.use(remultApi({})) // Integrate Remult as middleware
await app.listen(3002) // Start server on port 3002
}
bootstrap()- Add a simple
AppModuleinsrc/app.module.ts:
ts
// src/app.module.ts
import { Module } from '@nestjs/common'
@Module({})
export class AppModule {}Run the Nest.js server
Run the server with:
sh
npm run startYour Nest.js app with Remult is now up and running on port 3002.