
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
github.com/fermyon/enterprise-architectures-and-patterns/http-crud-go-sqlite
This is a sample implementation of CRUD (Create, Read, Update, Delete) in Go.
The sample is using SQLite for persistence and provides the following API endpoints via HTTP:
GET /items
- To retrieve a list of all itemsGET /items/:id
- To retrieve a item using its identifierPOST /items
- To create a new itemPUT /items/:id
- To update an existing item using its identifierDELETE /items/batch
- To delete multiple items providing an array of identifiers as payloadDELETE /items/:id
- To delete an existing item using its identifierSend data to POST /items
and PUT /items/:id
using the following structure:
{
"name": "item name",
// boolean (either true or false)
"active": true
}
To run the sample on your local machine, you must have the following software installed:
spin up
)To run the sample locally, you must provide @migrations.sql
using the --sqlite
flag to seed the database as shown in the snippet below:
# Build the project
spin build
# Run the sample
spin up --sqlite @migrations.sql
Logging component stdio to ".spin/logs/"
Storing default SQLite data to ".spin/sqlite_db.db"
Serving http://127.0.0.1:3000
Available Routes:
http-crud-go-sqlite: http://127.0.0.1:3000 (wildcard)
You can deploy this sample to Fermyon Cloud following the steps below:
# Authenticate
spin cloud login
# Deploy the sample to Fermyon Cloud
# This will ask if a new database should be created or an existing one should be used
# Answer the question with "create a new database"
spin deploy
Uploading http-crud-go-sqlite version 0.1.0 to Fermyon Cloud...
Deploying...
App "http-crud-go-sqlite" accesses a database labeled "default"
Would you like to link an existing database or create a new database?: Create a new database and link the app to it
What would you like to name your database?
What would you like to name your database?
Note: This name is used when managing your database at the account level. The app "http-crud-go-sqlite" will refer to this database by the label "default".
Other apps can use different labels to refer to the same database.: sincere-mulberry
Creating database named 'sincere-mulberry'
Waiting for application to become ready.......... ready
View application: https://http-crud-go-sqlite-jcmbpezb.fermyon.app/
Manage application: https://cloud.fermyon.com/app/http-crud-go-sqlite
# Ensure tables are created in the new database (here sincere-mulberry)
spin cloud sqlite execute --database sincere-mulberry @migrations.sql
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.