Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmartins-dev/apicarros-node-mysql
Create Api using NodeJs and MySql for study
https://github.com/gmartins-dev/apicarros-node-mysql
Last synced: 28 days ago
JSON representation
Create Api using NodeJs and MySql for study
- Host: GitHub
- URL: https://github.com/gmartins-dev/apicarros-node-mysql
- Owner: gmartins-dev
- Created: 2022-04-28T14:54:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-02T19:04:44.000Z (over 2 years ago)
- Last Synced: 2024-10-16T18:50:22.595Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
npm init -y
npm install express mysql dotenv cors body-parser
npm install nodemon --save-dev
git init
git branch -M main
git push origin main
variables => PORT=3000
"scripts": { "start": "nodemon ./src/server.js",
#creating initial routes file:
const express = require ('express') const router = express.Router()
module.exports = router
#creating initial server file:
require('dotenv').config({path:'variables.env'}) const express = require ('express') const cors = require('cors') const bodyParser = require('body-parser')
const routes = require('./routes')
const server = express() server.use(cors()) server.use(bodyParser.urlencoded({extended:false}))
server.listen(process.env.PORT, () => { console.log(Server running on: http://localhost:${process.env.PORT}) })