Giter Site home page Giter Site logo

084-nextjs-api's Introduction

Set up Instructions

  • Download Project Folder
  • Go to folder in your destop and run npm i
  • Once the dependencies get installed run npm run dev for test environment.

Available Pages

  • localhost:3000 (Page to POST data and GET text messages from database)
  • localhost:3000/feedback (Shows text messages as a List)
  • localhost:3000/api (Shows Database)
  • localhost:3000/api/someID (Request the database entry with given ID)

NextJS - API Notes

  • All backend API files will be stored in /pages/api/
  • localhost:3000/api will access the API file and show the result if the file under /pages/api is index.js. If it is a specially named file, for example aras.js, then it can be accessed from localhost:3000/api/aras
  • localhost:3000 designed to have email address and feedback field. Once sent, it will write the data to /data/database.json
  • The database data can be requested by going to localhost:3000/api
  • getStaticProps function can connect to API file. /pages/feedback/index.js has getStaticProps which can connect to /pages/api/index.js
  • API section can also have dynamic file name, which pretty much works like a dynamic page and the data can be accessed by req.query.id.
  • Slugs can also be used in API folder just like page creation [...slug].js.

084-nextjs-api's People

Contributors

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