TinyApp is a collection of backend endpoints for managing URLs in a URL shortening service. It provides functionalities such as URL creation, editing, deletion, and user authentication.
TinyApp Backend is built with Node.js and Express.js framework. It uses the following dependencies:
- express: Fast, unopinionated, minimalist web framework for Node.js
- cookie-session: Simple cookie-based session middleware
- bcryptjs: Library to hash passwords
- method-override: Middleware for overriding HTTP methods
- ejs: Embedded JavaScript templating engine
The following are the main endpoints provided by TinyApp Backend:
GET /
: Root endpoint. Redirects users to the login page if not logged in, otherwise redirects to the URLs index page.GET /urls
: Displays a list of URLs created by the logged-in user.GET /urls/new
: Renders a form to create a new URL.GET /urls/:id
: Displays details of a specific URL.POST /urls
: Creates a new URL.PUT /urls/:id
: Updates the URL with the specified ID.DELETE /urls/:id/delete
: Deletes the URL with the specified ID.GET /register
: Renders the registration page.GET /login
: Renders the login page.POST /register
: Registers a new user.POST /login
: Logs in an existing user.POST /logout
: Logs out the current user.GET /u/:id
: Redirects to the long URL associated with the specified short URL ID.
Method Override
: Uses forms PUT and DELETE.Analytics
: Keeps track of when an URL was created, the number of unique visits, the vitis log and displays it on the edit page for the URL.
- Clone the repository:
git clone https://github.com/aleaguilar01/tinyapp.git
- Install dependencies:
npm install
- Start the server:
npm start
- Open your web browser and navigate to
http://localhost:8080
- Register a new account or log in with an existing account.
- Create, edit, or delete URLs as needed.
Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.