-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
34 lines (27 loc) · 943 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Neo4jClient;
using Neo4j.Driver;
using SampleNeo4J.Services.Interface;
using SampleNeo4J.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IEmployeeService, EmployeeService>();
builder.Services.AddControllersWithViews();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var client = new BoltGraphClient(new Uri("bolt://localhost:7687"), "neo4j", "12345678");
await client.ConnectAsync();
builder.Services.AddSingleton<IGraphClient>(client);
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "/{controller=Home}/{action=Index}");
app.MapControllers();
app.Run();