Nest.js
Bootstrap Remult in the Nest.js back-end
- Create a
main.ts
file in thesrc/
folder with the following code:
ts
// src/main.ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { remultExpress } from 'remult/remult-express'
async function bootstrap() {
const app = await NestFactory.create(AppModule)
app.use(remultExpress()) // Integrate Remult as middleware
await app.listen(3002) // Start server on port 3002
}
bootstrap()
- Add a simple
AppModule
insrc/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 start
Your Nest.js app with Remult is now up and running on port 3002
.