Coder Social home page Coder Social logo

formsbackend's Introduction

Backend Server Setup Instructions

This repository contains the backend server for the project FormsReplica. Follow the steps below to set up and run the server locally.

Prerequisites

  • Node.js and npm installed on your machine.
  • TypeScript installed globally (npm install -g typescript).

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/Augnik03/formsBackend.git
  2. Navigate to the backend directory:

    cd formsBackend
  3. Install the dependencies:

    npm i express body-parser 
    npm i --save-dev typescript @types/express @types/node ts-node nodemon
    npm i --save-dev @types/cors

Configuration

  1. Create a db.json file in the src folder of the backend server.

  2. Define the structure of the JSON file to store submissions. For example:

    [
    
    ]

    Here it shows an empty array. This structure can be expanded based on your requirements for storing submissions.

Running the Server

  1. Start the backend server:

    npm run dev

    This command will start the server at the specified port (default is 3000).

Testing the Endpoints

You can use tools like Postman or cURL to test the API endpoints provided by the server. Here are the available endpoints:

  • GET /ping: Always returns true.
  • POST /submit: Create a new submission with parameters "name", "email", "phone", "github_link", and "stopwatch_time".
  • GET /read?index=<index>: Retrieve a submission by index.

Additional Notes

  • The backend server is configured to use a JSON file (db.json) as a database for storing submissions.
  • Ensure that the JSON file is writable by the server process.
  • You may need to adjust the port number if port 3000 is already in use on your system.

formsbackend's People

Contributors

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