Yet another link shortener app.
The following is a set of prerequisites to run the application locally
- Windows 10/11
- Visual Studio
- NodeJs (v20.x)
- .Net 8.0 SDK
- Auth0 API and Client configured to work with
- Docker Desktop
- MS SQL Database running in Docker container
For testing, the API and Angular application are pre-configured. No further steps are required.
If you would like to use your own Auth0 tenant and services, a couple of changes need to be made
Configuration can either be provided via the appsettings.json in the LinkIo.Web project. The following are the default values:
"Auth0": {
"Domain": "ngbridge.eu.auth0.com",
"Audience": "https://linkio.com"
},Or via system environment variables:
Auth0__DomainAuth0__Audience
Note: If configured, system environment variables will take precedence over the
appsettings.jsonfile.
The Backend depends on the following configurations in your Auth0 API:
- A set of permissions:
create:linksread:linksedit:linksdelete:links
- RBAC Settings ->
Enable RBACandAdd Permissions in the Access Tokenenabled.
Add a Role (named e.g, LinkIo Standard Users) and give it all the permissions you created in your Auth0 API configuration
Provide the following configurations in the environment.ts file:
... other parameters
auth0Domain: 'The Domain value from your Auth0 client',
auth0ClientId: 'The Client ID value from your Auth0 client',
auth0Audience: 'The Identifier value from your Auth0 API',The client must be a SPA client.
- Add these urls to the Allowed Callback URLs
https://localhost:44447, https://localhost:44447/links, - Add
https://localhost:44447to the Allowed Logout URLs, and Allowed Web Origins
This application was developed and tested using MS SQL server hosted on Docker Desktop locally. Use the following command to set up MS SQL server in a docker container
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Administrator1@" -e "MSSQL_PID=Evaluation" -p 1433:1433 --name sqlpreview --hostname sqlpreview -d mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04Alternative SQL Server installation methods will work with the application but the connection strings may need to change.
In Visual Studio, simply run the Web project, it will launch the backend and frontend.
Simply run dotnet test from the root directory of the project to run all tests.
The test suite contains a combination of Unit and Integration tests.
A set of integration tests have been implemented in the Application.FunctionalTests project.
By default, the integration tests will use a in-memory database constructed within code.
To use an actual SQL database for the Integration tests, a connection string must be provided. This can be provided either in the appsettings.json file. The connection string MUST be named TestDefaultConnection.
Alternatively, you can provide the connection string via environment variables. The environment variable must be named ConnectionStrings__TestDefaultConnection.
Assuming you're using the database setup described in the Prerequisites, you can provide the following connection string value
Server=127.0.0.1,1433;Database=LinkIoTestDb;User Id=SA;Password=Administrator1@;TrustServerCertificate=True;MultipleActiveResultSets=true