citelynq.websample/README.md

151 lines
3.0 KiB
Markdown

# CiteLynq Web Sample
A sample ASP.NET Core web application demonstrating how to integrate with the CiteLynq API for verified citations across multiple authoritative sources.
## Features
| Feature | Description |
|---------|-------------|
| ASP.NET Core 9.0 | Minimal API with modern C# patterns |
| Proxy Endpoints | Hide API keys from client-side code |
| Multi-Source Search | ArXiv, PubMed, CourtListener, and more |
| Citation Formats | APA, MLA, Chicago, Bluebook |
| Responsive UI | Clean, modern design for desktop and mobile |
| Local Storage | Persists API key in browser |
## Quick Start
### 1. Clone the Repository
```bash
git clone https://git.marketally.com/citelynq/CiteLynq.WebSample.git
cd CiteLynq.WebSample
```
### 2. Get an API Key
1. Visit [citelynq.com/app/api-keys](https://citelynq.com/app/api-keys)
2. Create a new API key
3. Copy the key (starts with `cl_`)
### 3. Run
```bash
dotnet run
```
Open `http://localhost:5100` in your browser.
## Project Structure
```
CiteLynq.WebSample/
├── Program.cs # ASP.NET Core minimal API
├── CiteLynq.WebSample.csproj # Project file
├── Properties/
│ └── launchSettings.json # Launch configuration
└── wwwroot/
└── index.html # Single-page application
```
## API Endpoints
### Search Citations
```http
GET /api/search?q=climate+change&sourceType=ArXiv&page=1&pageSize=20
X-API-Key: cl_your-api-key-here
```
### Get Article Details
```http
GET /api/articles/{id}
X-API-Key: cl_your-api-key-here
```
### Example Response
```json
{
"data": {
"results": [
{
"id": "arxiv-2301.12345",
"sourceType": "ArXiv",
"title": "Climate Change Research",
"authors": ["Dr. Jane Smith"],
"publishedDate": "2023-01-15",
"citations": {
"apa": "Smith, J. (2023)...",
"mla": "Smith, Jane..."
}
}
],
"totalCount": 145
}
}
```
## Configuration
### API Base URL
Edit `Program.cs`:
```csharp
const string API_BASE_URL = "https://citelynq.com/api";
```
### Port
Edit `Properties/launchSettings.json`:
```json
{
"profiles": {
"http": {
"applicationUrl": "http://localhost:5100"
}
}
}
```
## Development
### Prerequisites
- .NET 9.0 SDK
### Commands
```bash
dotnet build # Build
dotnet run # Run
dotnet publish -c Release # Publish
```
## Security Notes
- **API Keys**: The proxy pattern keeps keys server-side
- **CORS**: Configure specific origins for production
- **HTTPS**: Required for production deployments
## Troubleshooting
| Issue | Solution |
|-------|----------|
| Port in use | Change port in `launchSettings.json` |
| CORS errors | Check CORS configuration in `Program.cs` |
| API key invalid | Verify key starts with `cl_` and is active |
## Resources
- [CiteLynq API Docs](https://citelynq.com/docs)
- [Get API Key](https://citelynq.com/app/api-keys)
- [ASP.NET Core Docs](https://docs.microsoft.com/aspnet/core)
## License
MIT - Use freely in your own projects.