The Readup API server is written in ASP.NET 3.1. Its main functions are:
See the dev-env instructions to set up this API server as a service within a Docker Compose project. This is the easiest way to get started.
By using the container of the Docker Compose service as a VSCode Remote, you can leverage the OmniSharp .NET language tools and IntelliSense while developing without having to install them on your host system.
The .devcontainer/devcontainer.json
and Dockerfile
have already been set up with the right OmniSharp configuration for this .NET 3.1 project, as long as you installed the Docker Compose project as suggested above.
Learn more about how to load this folder into a VSCode instance within the container here: Developing inside a Container.
To debug the watcher started by default by the container, attach VSCode to the /api/bin/Debug/netcoreapp3.1/api
process.
Configure the ASP.NET core environment for development: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-3.1#set-the-environment
export ASPNETCORE_ENVIRONMENT=Development
Create the following configuration files, making these changes:
PG_USER
, PG_PASS
and DB_NAME
under the Database
section with the values you chose during the database setup.SystemEmojiFontName
under the TwitterImageRendering
section. The default values are Apple Color Emoji
or Segoe UI Emoji
for macOS and Windows respectively. When running with Linux, find, install and enter Noto Color Emoji
.
Host
and Port
under the Email.SmtpServer
section if you want to capture email messages that would be sent by the server.StripeApiSecretKey
under the Subscriptions
section if you want to perform test purchases through Stripe.StripeWebhookSigningSecret
under the Subscriptions
section if you want to receive and process Stripe webhook events.Note the following regarding 3rd party services:
Twitter integration is supported in development mode using the Readup Twitter Test Server: https://github.com/reallyreadit/twitter-test-server
hostsettings.json
{
"urls": "http://0.0.0.0:5000"
}
appsettings.json
{
"Authentication": {
"ApiKey": "AAAAAAAAAAAAAAAAAAAAAA==",
"CookieName": "devSessionKey",
"CookieSecure": "Always",
"Scheme": "rrit-auth-scheme",
"TwitterAuth": {
"BrowserAuthCallback": "https://api.dev.readup.org/Auth/TwitterAuthenticationCallback",
"BrowserLinkCallback": "https://api.dev.readup.org/Auth/TwitterLinkCallback",
"BrowserPopupCallback": "https://api.dev.readup.org/Auth/TwitterPopupCallback",
"ConsumerKey": "",
"ConsumerSecret": "",
"SearchAccount": {
"Handle": "",
"OAuthToken": "",
"OAuthTokenSecret": ""
},
"TwitterApiServerUrl": "https://twitter-test.dev.readup.org",
"TwitterUploadServerUrl": "https://twitter-test.dev.readup.org",
"WebViewCallback": "readup://"
}
},
"Captcha": {
"VerifyCaptcha": false
},
"Cookies": {
"Domain": ".dev.readup.org"
},
"Cors": {
"AllowedOrigins": [
"chrome-extension://",
"https://blog.dev.readup.org",
"https://dev.readup.org",
"moz-extension://",
"safari-web-extension://"
]
},
"Database": {
"ConnectionString": "Host=localhost;Username=PG_USER;Password=PG_PASS;Database=DB_NAME"
},
"Embed": {
"AllowedHosts": [
"blog.dev.readup.org"
]
},
"Email": {
"DeliveryMethod": "Smtp",
"From": {
"Name": "Readup",
"Address": "no-reply@readup.org"
},
"SmtpServer": {
"Host": "",
"Port": 0
}
},
"Hashids": {
"Salt": "AAAAAAAAAAAAAAAAAAAAAA=="
},
"PushNotifications": {
"ApnsServer": {
"Protocol": "https",
"Host": "api.sandbox.push.apple.com"
},
"ClientCertThumbprint": ""
},
"ReadingVerification": {
"EncryptionKey": "AAAAAAAAAAAAAAAAAAAAAA=="
},
"ServiceEndpoints": {
"ApiServer": {
"Protocol": "https",
"Host": "api.dev.readup.org"
},
"StaticContentServer": {
"Protocol": "https",
"Host": "static.dev.readup.org"
},
"WebServer": {
"Protocol": "https",
"Host": "dev.readup.org"
}
},
"Subscriptions": {
"AppStoreSandboxUrl": "https://sandbox.itunes.apple.com/verifyReceipt",
"AppStoreProductionUrl": "https://buy.itunes.apple.com/verifyReceipt",
"ProviderAccountEnvironment": "Production",
"StripeApiSecretKey": "",
"StripeSubscriptionProductId": "prod_v1_subscription",
"StripeWebhookSigningSecret": ""
},
"Tokenization": {
"EncryptionKey": "AAAAAAAAAAAAAAAAAAAAAA=="
},
"TwitterImageRendering": {
"SystemEmojiFontName": ""
}
}
Restore packages
dotnet restore
Build and run the server
dotnet watch run