https://github.com/ranjithdb/gh-actions-nodejs-02
https://github.com/ranjithdb/gh-actions-nodejs-02
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/ranjithdb/gh-actions-nodejs-02
- Owner: ranjithdb
- Created: 2025-03-01T10:33:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-01T11:09:58.000Z (over 1 year ago)
- Last Synced: 2025-03-01T11:28:21.395Z (over 1 year ago)
- Language: JavaScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gh-actions-nodejs-02
## URL Shortener with GitHub Actions
A simple URL shortener built with Node.js and Express.js that stores shortened URLs in a JSON file.
## Features
- Shorten long URLs into short links
- Redirect users from short links to the original URL
- Store URL mappings in a JSON file (no database needed)
## Installation
Clone the repository
install dependencies:
```sh
npm ci
```
## Running the Application
Start the server locally:
```sh
npm start
```
The server will run on `http://localhost:3000`.
## API Usage
### Shorten a URL
To shorten a URL, use the following curl command:
```sh
curl -X POST http://localhost:3000/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
```
#### Response
```json
{
"shortUrl": "http://localhost:3000/abc123"
}
```
## Testing
Run the tests using Jest:
```sh
npm test
```
## GitHub Actions CI
Every push to `main` triggers an automated build and test using GitHub Actions.
---