- Install Node.js version 14 or higher
- Clone the repository
git clone https://github.com/dfelix/tunity-backend-challenge.git
- Install dependencies
cd tunity-backend-challenge
npm install
- Build and run the project
npm start
Navigate to http://localhost:3000
The folder structure of this app is explained below:
Name | Description |
---|---|
src/index.ts | Entry point to express |
src/site-map-parser.js | SiteMapParser. Handles request, url validation and returns a clean array with links under baseURL |
package.json | Contains npm dependencies as well as build scripts |
All the different build steps are orchestrated via npm scripts. Npm scripts basically allow us to call (and chain) terminal commands via npm.
Npm Script | Description |
---|---|
start |
Runs full build and runs node on dist/index.js. |
npm start:dev |
Runs on development mode |
Local:
curl --location --request GET 'http://127.0.0.1:3000?url=https://www.w3schools.com/'
Response:
[
{
"name": "Videos NEW",
"url": "https://www.w3schools.com/videos/index.php"
},
{
"name": "Website NEW",
"url": "https://www.w3schools.com/spaces"
},
{type
"name": "Paid Courses",
"url": "https://www.w3schools.com/cert/default.asp"
},
...
]
No tests were created. TODO?