Skip to content

codewithleader/restserver

Repository files navigation

WebServer + REST Server with Node JS

Elis Antonio Pérez

Follow me: Instagram

Server code skeleton.

Add public folder.

  • Middlewares: use.static

Postman: HTTP Requests

  • GET
  • POST
  • PUT
  • DELETE
  • PATCH

CORS

  • Installed middleware 'CORS' with 'yarn add cors'.
Cross-Origin Resource Sharing (CORS)

Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by which browsers make a "preflight" request to the server hosting the cross-origin resource, in order to check that the server will permit the actual request. In that preflight, the browser sends headers that indicate the HTTP method and headers that will be used in the actual request. More...

Mongoose

URI

A URI (Uniform Resource Identifier) is a string that refers to a resource. The most common are URLs, which identify the resource by giving its location on the Web. More...

No More Deprecation Warning Options

useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are true, and useFindAndModify is false. Please remove these options from your code.

// No longer necessary:
mongoose.set('useFindAndModify', false);

await mongoose.connect('mongodb://localhost:27017/test', {
  useNewUrlParser: true, // <-- no longer necessary
  useUnifiedTopology: true // <-- no longer necessary
});

More

Express-validator

Heroku commands:

heroku config

heroku config:set ENVIRONMENT_VARIABLE_NAME=valueText123ABC

git push heroku main

heroku logs -n 100 --tail

Heroku link

https://web-rest-server-nodejs.herokuapp.com

Google Sign In:

https://developers.google.com/identity/gsi/web/guides/overview

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published