# Infrastructure-Agnostic

Nest is designed to run anywhere, whether locally, in the cloud, or in serverless environments. This makes it perfect for developers who need flexibility in their deployment strategy.

Use cases:

* Run locally for small-scale projects or testing.
* Deploy in cloud environments for production workloads.
* Use serverless functions for cost-efficient, scalable operations.

```typescript
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { INestApplication } from '@nestjs/common';

async function bootstrap() {
  const app: INestApplication = await NestFactory.create(AppModule);
  
  // Set global prefix for all routes
  app.setGlobalPrefix('api');

  // Enable CORS for all routes
  app.enableCors({
    origin: 'http://localhost:4200',
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
    credentials: true,
  });

  // Use a custom logger
  app.useLogger(['log', 'error', 'warn', 'debug']);

  // Start the application and listen on a specified port
  const port = process.env.PORT || 3000;
  await app.listen(port, () => {
    console.log(`Application running on http://localhost:${port}/api`);
  });
}
bootstrap();
```
