Coder Social home page Coder Social logo

first-name-book-searcher's Introduction

📚 Oliver Twist Name searcher

Input a name and see if it’s in Oliver Twist

Getting Started

git clone https://github.com/myinusa/first-name-book-searcher.git

cd first-name-book-searcher

npm install

npm run start - This will start the application and run on port 3001

Visit http://localhost:3001/name-count/:name

Example: http://localhost:3001/name-count/Oliver

[
    {
        "name": "Martin",
        "total": 1
    }
]

Run node /script/count.js to write a file resources/sorted-names.json that outputs the number of occurrences from firstName.txt in Oliver-twist.txt extract

[
  { name: 'Oliver', total: 437 },
  { name: 'Noah', total: 46 },
  { name: 'Rose', total: 46 },
  { name: 'Charley', total: 42 }
  ...
]

Project Structure

Name Description
server/index.ts Application entry point
server/server.ts Initialization of server
server/controllers/name-countCtrl.js Handles request for name count
server/routes/name-count.js Defines /name-count endpoint
server/routes/routes.ts Application routes / endpoints
script/count.js Outputs number of occurrences from firstName.txt in Oliver-twist.txt extract
resources/first-names.txt List of first names
resources/oliver-twist.txt Oliver twist book

Dependencies

List of Dependencies Description
body-parser Node.js body parsing middleware.
cors CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
express Fast, unopinionated, minimalist web framework for node.
nodemon helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected
@typescript-eslint/parser An ESLint parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
@typescript-eslint/eslint-plugin An ESLint plugin which provides lint rules for TypeScript codebases.
@types/express This package contains type definitions for Express (http://expressjs.com).
typescript TypeScript is a superset of JavaScript which primarily provides optional static typing, classes and interfaces.
tslint TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors.

Documentation

IMPORT WITH POSTMAN

Download the postman collection to test the endpoints in postman - located in resources/postman

Database

The data is stored under /resources/ . Using the node library fs we read the file before parsing in JSON.

Endpoint

Endpoint Description
GET /name-count/:name returns number of occurrences by query of name

first-name-book-searcher's People

Contributors

myinusa 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.