|  | @@ -6,11 +6,28 @@ import os
 | 
											
												
													
														|  |  import dataset
 |  |  import dataset
 | 
											
												
													
														|  |  import datetime
 |  |  import datetime
 | 
											
												
													
														|  |  import json
 |  |  import json
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +from fastapi.middleware.cors import CORSMiddleware
 | 
											
												
													
														|  |  db = dataset.connect('sqlite:///similar.db')
 |  |  db = dataset.connect('sqlite:///similar.db')
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  app = FastAPI()
 |  |  app = FastAPI()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +origins = [
 | 
											
												
													
														|  | 
 |  | +    "http://www.googo.org",
 | 
											
												
													
														|  | 
 |  | +    "http://googo.org",
 | 
											
												
													
														|  | 
 |  | +    "http://139.162.121.30"
 | 
											
												
													
														|  | 
 |  | +]
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +app.add_middleware(
 | 
											
												
													
														|  | 
 |  | +    CORSMiddleware,
 | 
											
												
													
														|  | 
 |  | +    allow_origins=origins,
 | 
											
												
													
														|  | 
 |  | +    allow_credentials=True,
 | 
											
												
													
														|  | 
 |  | +    allow_methods=["*"],
 | 
											
												
													
														|  | 
 |  | +    allow_headers=["*"],
 | 
											
												
													
														|  | 
 |  | +)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  @app.get("/domain/{domain_name}")
 |  |  @app.get("/domain/{domain_name}")
 | 
											
												
													
														|  |  async def read_item(domain_name):
 |  |  async def read_item(domain_name):
 | 
											
												
													
														|  |      cursor=db.query('select domain_name,json,dt from similar where domain_name="'+domain_name+'"')
 |  |      cursor=db.query('select domain_name,json,dt from similar where domain_name="'+domain_name+'"')
 |