Giter Club home page Giter Club logo

basic-node-api's Introduction

basic-node-api

This is a barebones API built using NodeJS and Express. Feel free to make use of this as a basis for a project.

The API uses JWT tokens in the authentication.

The API relies on Mongoose, and by extension on MongoDB as the database.

Setup

  1. Clone this repo to your local machine.
  2. Run npm install bcrypt-nodejs body-parser express jsonwebtoken mongoose morgan --save

This will install all dependencies and anything else needed based on package.json. You could also just run npm install and let npm do the work. I just tend to be explicit. It's your call whatever works best for you.

Usage

To use this as a basis for an API, you will have to create a file called config.js at the root level.

In that file, you will have to set an export so that your server.js file can make use of you config settings. The config file should be structured as follows:

module.exports = {
  'port': process.env.PORT || 8888,
  'database': 'path_to_your_db_of_choice',
  'secret': 'your_secret_string'
}

Note: The "database of choice" for your app must be a MongoDB database unless you change out the packages to use something created for a different type of DB. You can conceivably use anything. It is simply that this API is set up to work with MongoDB out of the box. Also note that the server.js file already requires config.js by default so you will not have to add a require line, but you absolutely need this file to run this server without error.

basic-node-api's People

Contributors

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