Skip to content

This Git repository hosts a simple web app that allows users to easily access space-related news and articles from various sources. With a clean and ad-free interface. This repository serves as a useful example for developers who wish to build similar apps, showcasing how to effectively interact with APIs to provide relevant content.

clair-beep/Universe-Hubs

Repository files navigation

Universe Hubs

A lightweight, minimalistic API client developed in JavaScript with the following goals in mind:

Small, single purpose module, i.e. talk to the rest API Works in a environment No abstraction over data, what you see is what you get Clean api Small bundle footprint Minimal request validation Predictable and consistent responses Full test coverage

Installation

Install my-project with npm

  npm install 
  

Deployment

To deploy this project run

  npm start

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PORT

CACHE_EXPIRATION_TIME

Optimizations

Caching: caching is an effective technique to reduce the number of API calls and improve application performance. Memory-cache package to cache dataBut there's space to build a more robust caching solution like Redis or Memcached for more flexibility and scalability.

Error handling: catch block is currently handling errors. However,there's room to build a more detailed error messages to help with debugging. For example, log the error stack trace or provide a custom error message that describes the error in more detail.

Query parameters: more query parameters could be added to my API endpoints to allow users to filter and sort the results.Such as to be able filter by date, author, category, or location.

Pagination: add page numbers make it easier for users to navigate through the results.

Response compression: the response data can be compressed to reduce the amount of data transmitted over the network.Considering to use middleware such as compression or zlib to compress the response data before sending it to the client.

Rate limiting: rate limiting should be implement to prevent abuse and ensure fair usage of the API. Considering to use express-rate-limit to limit the number of requests per IP address or per API key.

Monitoring: monitor the application and ensure that it's running smoothly. Tools such as PM2 can automatically restart your application if it crashes or becomes unresponsive, and it can also generate logs and performance metrics.

Security: security messures are crucial to protect the API from attacks, such as XSS, CSRF, and SQL injection. Packages like helmet, csurf, and sequelize to add security features to the application.

Roadmap

  • Additional query parameters to be added

  • Rate limiting

Tech Stack

Client: EJS, CSS, BOOTSRAP

Server: Node, Express

API Reference

Get all items

  GET /
Parameter Type Description
query parameters string Returns the latest articles on space news for today.

Get item

  GET /this-week-news
Parameter Type Description
query parameters string Returns a list of articles from space news published this week.

Get item

  GET /space-news/${title_contains}
Parameter Type Description
query parameters string Required. title_contains
Returns a list of articles within the search criteria

Get item

License

MIT

About

This Git repository hosts a simple web app that allows users to easily access space-related news and articles from various sources. With a clean and ad-free interface. This repository serves as a useful example for developers who wish to build similar apps, showcasing how to effectively interact with APIs to provide relevant content.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published