所以,我是 nextJS 的新手。我使用安装了最新版本(13.3.4)npx create-next-app@latest,它可以工作,在端口 3000 等上提供服务。
现在我正在了解一个包含一些文件的应用程序目录layout.tsx,page.tsx但我在项目文件中找不到它们。
我检查了他们的文档,甚至手动添加app目录、布局和页面文件,并对它们进行了更改,但没有任何改变。
怎么了?
更新:
这是 next.config.js 文件
我正在使用 .net core 开发一个 API,并且即将使用依赖注入,但我意识到ConfigureServices(IServiceCollection services)Startup 类中的方法被服务注入堵塞是我不喜欢的。例如...
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddDbContext<MyDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MyConnection")));
services.AddScoped<IServiceOne, ServiceOne>();
services.AddScoped<IServiceTwo, ServiceTwo>();
services.AddScoped<IServiceThree, ServiceThree>();
services.AddScoped<IServiceFour, ServiceFour>();
//more and more services. This could go on and on and that would make the whole class ugly
}
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以将所有这些服务放在一个类中并在 Startup 类中调用它们?我使用的是asp.net3.1。
谢谢。