Code Monkey home page Code Monkey logo

js-validator's Introduction

JSValidator - JavaScript Code Validator

The JSValidator is a service that uses the JSHint API to check your JavaScript code for errors and potential problems. The service is a code quality tool that useful for everyone who wants to validate their JavaScript code regularly. It also can be used to check the code of Code Institute students' projects before they submit them for review.

Technologies Used

The project is built using the following technologies:

Deployment

Live link of the JSValidator: https://js-validator.netlify.app/

The JSValidator is a static web service that deployed on Netlify from GitHub and using Netlify Serverless Functions to hide the JSHint API key from the public

The Simple implementation of the JSValidator with exposed API key and withouth using the back-end functions and jQuery can be found on the branch no-netlify. This branch is not deployed.

How to receive and use the CodeInstitute JSHint API?

The JSValidator uses the JSHint API which allows developer to run JSHint on your code without having to install anything.

The CodeInstitute JSHint API is free but it does require an API key, so you’ll need to complete the sign-up process.

The key is only available to current students of Code Institute, and the API will check that before giving you the key. All API keys are valid for a period of 1 year.

To receive a key go to https://ci-jshint.herokuapp.com/ and type your email address that you used when you signed up for the Code Institute course. You will be issued with a key if you are a current student of Code Institute.

Usage Instructions can be found on the same page under the registration form.

Netlify Serverless Functions

Hide the JSHint API Key using Netlify Serverless Functions The API key is sensitive information and should not be exposed to the public. To hide the API key from the public, I used Netlify Serverless Functions to call the JSHint API. The Netlify functions are a way to run server-side code without having to manage or maintain a server. External APIs can be integrated with a serverless function to grab data, that can then be used in the response.

In this case the function make a request to the JSHint API using axios on a server side without exposing our API key and returns the response in form of a JSON object with status code and body. Then the client side fetches the response using fetch() and displays the result to the user.

To use the Netlify Serverless Functions, you need to create a Netlify account and link it to your GitHub repository. You can find more information about the Netlify Serverless Functions by following the links:

Netlify Requirements

Files:

The Netlify Serverless Functions require the following files:

  • netlify.toml - Netlify configuration file
  • package.json - Node.js package file
  • netlify/functions/ - directory for the Netlify Serverless Functions
Dependencies:

The Netlify Serverless Functions require the following dependencies:

  • netlify-cli - Netlify CLI
  • netlify-lambda - Netlify Lambda
  • dotenv - loads environment variables from a .env file
  • axios - Promise based HTTP client for the browser and node.js

Run the development Node.js server to test the Netlify Serverless Functions locally:

netlify dev

Credits

js-validator's People

Contributors

pavlo-myskov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.